
#include <stdlib.h>
#include <stdio.h>
#include "xmlmanage.h"

///////////////////////////////////////////////////////////////////////////
//主函数部分

///////////////////////////////////////////////////////////////////////////
//构建部分
//////////////////////////////////////////////////////////////////////////

//函数功能		生成根结点
//name			[in]根结点名称
//返回值：		根结点指针，失败返回NULL
S_XMLItem	*Xml_MakeRoot(const char *name)
{
	S_XMLItem	*root, *xml;

	root =  xml_new();

	if(root == NULL)
		return NULL;

	xml = xml_AddItem(root, (char*)name, NULL);
	
	return xml;
}


//函数功能		生成识别XML信息
//boot			[in]根结点
//param			[in]识别参数
//返回值：		成功返回1，失败返回0
int		Xml_MakeRecParamXml(S_XMLItem *root, const SRecParam *param)
{
	S_XMLItem	*RecItem;						//识别层结点
	S_XMLItem	*first, *second, *third;		//识别层以下各层结点
	char	szCasual[NODEVALUE_MAX_LENGTH], szCasual2[NODEVALUE_MAX_LENGTH];
	int i = 0;
	
	RecItem = xml_AddItem(root, "RecParam", NULL);
	if(RecItem == NULL)
		return 0;

	first = xml_AddItem(RecItem, "RecRect", NULL);		//识别区根结点
	if(first == NULL)
		return 0;


	sprintf(szCasual, "%d", param->recRect.top);
	second = xml_AddItem(first, "Top", szCasual);
	if(second == NULL)
		return 0;

	sprintf(szCasual, "%d", param->recRect.bottom);
	second = xml_AddItem(first, "Bottom", szCasual);
	if(second == NULL)
		return 0;

	sprintf(szCasual, "%d", param->recRect.leftT);
	second = xml_AddItem(first, "LeftTop", szCasual);
	if(second == NULL)
		return 0;

	sprintf(szCasual, "%d", param->recRect.leftB);
	second = xml_AddItem(first, "LeftBottom", szCasual);
	if(second == NULL)
		return 0;

	sprintf(szCasual, "%d", param->recRect.rightT);
	second = xml_AddItem(first, "RightTop", szCasual);
	if(second == NULL)
		return 0;

	sprintf(szCasual, "%d", param->recRect.rightB);
	second = xml_AddItem(first, "RightBottom", szCasual);
	if(second == NULL)
		return 0;

	first = xml_AddItem(RecItem, "OtherParam", NULL);		//其它参数根结点
	if(first == NULL)
		return 0;

	sprintf(szCasual, "%d", param->capModel);
	second = xml_AddItem(first, "CapModel", szCasual);
	if(second == NULL)
		return 0;

	sprintf(szCasual, "%d", param->capDelay);
	second = xml_AddItem(first, "CapDelay", szCasual);
	if(second == NULL)
		return 0;

	sprintf(szCasual, "%d", param->lightControl);
	second = xml_AddItem(first, "LightControl", szCasual);
	if(second == NULL)
		return 0;

	sprintf(szCasual, "%d", param->lightModel);
	second = xml_AddItem(first, "LightModel", szCasual);
	if(second == NULL)
		return 0;

	sprintf(szCasual, "%d", param->rightChar);
	second = xml_AddItem(first, "RightChar", szCasual);
	if(second == NULL)
		return 0;

	strcpy(szCasual, param->inChar);
	second = xml_AddItem(first, "InChar", szCasual);
	if(second == NULL)
		return 0;

	sprintf(szCasual, "%d", param->carDirection);
	second = xml_AddItem(first, "CarDirection", szCasual);
	if(second == NULL)
		return 0;

	sprintf(szCasual, "%d", param->capPosition);
	second = xml_AddItem(first, "CapPosition", szCasual);
	if(second == NULL)
		return 0;

	sprintf(szCasual, "%d", param->underLineReplace);
	second = xml_AddItem(first, "LineReplace", szCasual);
	if(second == NULL)
		return 0;

	sprintf(szCasual, "%d", param->runDec);
	second = xml_AddItem(first, "RunDec", szCasual);
	if(second == NULL)
		return 0;

	sprintf(szCasual, "%d", param->noPlateDec);
	second = xml_AddItem(first, "NoPlateDec", szCasual);
	if(second == NULL)
		return 0;

	sprintf(szCasual, "%d", param->horizonSlope);
	second = xml_AddItem(first, "HorizonSlope", szCasual);
	if(second == NULL)
		return 0;

	sprintf(szCasual, "%d", param->verticalSlope);
	second = xml_AddItem(first, "VerticalSlope", szCasual);
	if(second == NULL)
		return 0;

	sprintf(szCasual, "%d", param->isPlateMatch);
	second = xml_AddItem(first, "IsPlateMatch", szCasual);
	if(second == NULL)
		return 0;

	sprintf(szCasual, "%d", param->howPlateMatch);
	second = xml_AddItem(first, "HowPlateMatch", szCasual);
	if(second == NULL)
		return 0;

	sprintf(szCasual, "%d", param->outBigImg);
	second = xml_AddItem(first, "OutBigImg", szCasual);
	if(second == NULL)
		return 0;

	sprintf(szCasual, "%d", param->outSmallImg);
	second = xml_AddItem(first, "OutSmallImg", szCasual);
	if(second == NULL)
		return 0;

	sprintf(szCasual, "%d", param->outBinImg);
	second = xml_AddItem(first, "OutBinImg", szCasual);
	if(second == NULL)
		return 0;

	sprintf(szCasual, "%d", param->cutBig);
	second = xml_AddItem(first, "CutBig", szCasual);
	if(second == NULL)
		return 0;

	second = xml_AddItem(first, "CutRect", NULL);		//剪切区域根结点
	if(second == NULL)
		return 0;

	sprintf(szCasual, "%d", param->cutRect.top);
	third = xml_AddItem(second, "Top", szCasual);
	if(third == NULL)
		return 0;

	sprintf(szCasual, "%d", param->cutRect.bottom);
	third = xml_AddItem(second, "Bottom", szCasual);
	if(third == NULL)
		return 0;

	sprintf(szCasual, "%d", param->cutRect.left);
	third = xml_AddItem(second, "Left", szCasual);
	if(third == NULL)
		return 0;

	sprintf(szCasual, "%d", param->cutRect.right);
	third = xml_AddItem(second, "Right", szCasual);
	if(third == NULL)
		return 0;

	first = xml_AddItem(RecItem, "HideParam", NULL);		//隐藏参数根结点
	if(first == NULL)
		return 0;

	sprintf(szCasual, "%d", param->noShieldPlate);
	second = xml_AddItem(first, "NoShieldPlate", szCasual);
	if(second == NULL)
		return 0;

	sprintf(szCasual, "%d", param->maxRectCount);
	second = xml_AddItem(first, "MaxRectCount", szCasual);
	if(second == NULL)
		return 0;

	sprintf(szCasual, "%d", param->lightInterval);
	second = xml_AddItem(first, "LightInterval", szCasual);
	if(second == NULL)
		return 0;

	sprintf(szCasual, "%d", param->lightSwitch);
	second = xml_AddItem(first, "LightSwitch", szCasual);
	if(second == NULL)
		return 0;

	sprintf(szCasual, "%d", param->doublePlateRec);
	second = xml_AddItem(first, "DoublePlateRec", szCasual);
	if(second == NULL)
		return 0;

	sprintf(szCasual, "%d", param->doubleYellowRec);
	second = xml_AddItem(first, "DoubleYellowRec", szCasual);
	if(second == NULL)
		return 0;

	sprintf(szCasual, "%d", param->isDelCharNoise);
	second = xml_AddItem(first, "IsDelCharNoise", szCasual);
	if(second == NULL)
		return 0;

	sprintf(szCasual, "%d", param->plateWidthFlag);
	first = xml_AddItem(RecItem, "plateWidthFlag", szCasual);
	if(first == NULL)
		return 0;

	sprintf(szCasual, "%d", param->maxPlateWidth);
	first = xml_AddItem(RecItem, "maxPlateWidth", szCasual);
	if(first == NULL)
		return 0;

	sprintf(szCasual, "%d", param->minPlateWidth);
	first = xml_AddItem(RecItem, "minPlateWidth", szCasual);
	if(first == NULL)
		return 0;
	
	sprintf(szCasual, "%d", param->writeParamToTailFlag);
	first = xml_AddItem(RecItem, "writeParamToTailFlag", szCasual);
	if(first == NULL)
		return 0;

	sprintf(szCasual, "%d", param->white2NoPlateFlag);
	first = xml_AddItem(RecItem, "white2NoPlateFlag", szCasual);
	if(first == NULL)
		return 0;

	sprintf(szCasual, "%d", param->reserve2);
	first = xml_AddItem(RecItem, "Reserve2", szCasual);
	if(first == NULL)
		return 0;

	first = xml_AddItem(RecItem, "Reserve3", param->reserve3);
	if(first == NULL)
		return 0;

	first = xml_AddItem(RecItem, "Reserve4", param->reserve4);
	if(first == NULL)
		return 0;

	//////

	first = xml_AddItem(RecItem, "RecOutLine", NULL);		//虚拟触发线根结点
	if(first == NULL)
		return 0;

	sprintf(szCasual, "%d", param->RecOutLine[0].x);
	second = xml_AddItem(first, "StartX", szCasual);
	if(second == NULL)
		return 0;

	sprintf(szCasual, "%d", param->RecOutLine[0].y);
	second = xml_AddItem(first, "StartY", szCasual);
	if(second == NULL)
		return 0;

	sprintf(szCasual, "%d", param->RecOutLine[1].x);
	second = xml_AddItem(first, "EndX", szCasual);
	if(second == NULL)
		return 0;

	sprintf(szCasual, "%d", param->RecOutLine[1].y);
	second = xml_AddItem(first, "EndY", szCasual);
	if(second == NULL)
		return 0;

	///////////////////////////////////////////////////////////////////
	first = xml_AddItem(RecItem, "DetectStealRecRect", NULL);		//识别区根结点
	if(first == NULL)
		return 0;

	sprintf(szCasual, "%d", param->DetectStealAllEnable);
	second = xml_AddItem(first, "AllEnable", szCasual);
	if(second == NULL)
		return 0;

	sprintf(szCasual, "%d", param->DetectStealChildEnable);
	second = xml_AddItem(first, "ChildEnable", szCasual);
	if(second == NULL)
		return 0;

	sprintf(szCasual, "%d", param->DetectStealRecRect.top);
	second = xml_AddItem(first, "Top", szCasual);
	if(second == NULL)
		return 0;

	sprintf(szCasual, "%d", param->DetectStealRecRect.bottom);
	second = xml_AddItem(first, "Bottom", szCasual);
	if(second == NULL)
		return 0;

	sprintf(szCasual, "%d", param->DetectStealRecRect.leftT);
	second = xml_AddItem(first, "LeftTop", szCasual);
	if(second == NULL)
		return 0;

	sprintf(szCasual, "%d", param->DetectStealRecRect.leftB);
	second = xml_AddItem(first, "LeftBottom", szCasual);
	if(second == NULL)
		return 0;

	sprintf(szCasual, "%d", param->DetectStealRecRect.rightT);
	second = xml_AddItem(first, "RightTop", szCasual);
	if(second == NULL)
		return 0;

	sprintf(szCasual, "%d", param->DetectStealRecRect.rightB);
	second = xml_AddItem(first, "RightBottom", szCasual);
	if(second == NULL)
		return 0;
	//////////////////////////////////////////////////////////////////////////
	first = xml_AddItem(RecItem, "SpeedParam", NULL);		//测速参数根结点
	if(first == NULL)
		return 0;

	sprintf(szCasual, "%d", param->cameraHeight);
	second = xml_AddItem(first, "CameraHeight", szCasual);
	if(second == NULL)
		return 0;

	sprintf(szCasual, "%d", param->nearLength);
	second = xml_AddItem(first, "NearLength", szCasual);
	if(second == NULL)
		return 0;

	sprintf(szCasual, "%d", param->farLength);
	second = xml_AddItem(first, "FarLength", szCasual);
	if(second == NULL)
		return 0;

	sprintf(szCasual, "%d", param->vdSpeedRevise);
	second = xml_AddItem(first, "VdSpeedRevise", szCasual);
	if(second == NULL)
		return 0;
	//////////////////////////////////////////////////////////////////////////

	first = xml_AddItem(RecItem, "RoadParam", NULL);		//车道参数根结点
	if(first == NULL)
		return 0;

	sprintf(szCasual, "%d", param->roadTop);
	second = xml_AddItem(first, "RoadTop", szCasual);
	if(second == NULL)
		return 0;

	sprintf(szCasual, "%d", param->roadBottom);
	second = xml_AddItem(first, "RoadBottom", szCasual);
	if(second == NULL)
		return 0;

	second = xml_AddItem(first, "RoadFlag", NULL);		//车道标记
	if(second == NULL)
		return 0;

	for(i = 0; i< MAX_ROAD_NUM; i++)
	{
		sprintf(szCasual2, "F%d", i);
		sprintf(szCasual, "%d", param->roadFlag[i]);
		third = xml_AddItem(second, szCasual2, szCasual);
		if(third == NULL)
			return 0;
	}

	second = xml_AddItem(first, "RoadDirection", NULL);		//车道驶向
	if(second == NULL)
		return 0;

	for(i = 0; i< MAX_ROAD_NUM; i++)
	{
		sprintf(szCasual2, "F%d", i);
		sprintf(szCasual, "%d", param->roadDirection[i]);
		third = xml_AddItem(second, szCasual2, szCasual);
		if(third == NULL)
			return 0;
	}

	second = xml_AddItem(first, "RoadLeftT", NULL);		//车道左上坐标
	if(second == NULL)
		return 0;

	for(i = 0; i< MAX_ROAD_NUM; i++)
	{
		sprintf(szCasual2, "RLT%d", i);
		sprintf(szCasual, "%d", param->roadLeftT[i]);
		third = xml_AddItem(second, szCasual2, szCasual);
		if(third == NULL)
			return 0;
	}
	second = xml_AddItem(first, "RoadRightT", NULL);		////车道右上坐标
	if(second == NULL)
		return 0;

	for(i = 0; i< MAX_ROAD_NUM; i++)
	{
		sprintf(szCasual2, "RRT%d", i);
		sprintf(szCasual, "%d", param->roadRightT[i]);
		third = xml_AddItem(second, szCasual2, szCasual);
		if(third == NULL)
			return 0;
	}
	second = xml_AddItem(first, "RoadLeftB", NULL);		//车道左下坐标
	if(second == NULL)
		return 0;

	for(i = 0; i< MAX_ROAD_NUM; i++)
	{
		sprintf(szCasual2, "RLB%d", i);
		sprintf(szCasual, "%d", param->roadLeftB[i]);
		third = xml_AddItem(second, szCasual2, szCasual);
		if(third == NULL)
			return 0;
	}
	second = xml_AddItem(first, "RoadRightB", NULL);		//车道右下坐标
	if(second == NULL)
		return 0;

	for(i = 0; i< MAX_ROAD_NUM; i++)
	{
		sprintf(szCasual2, "RRB%d", i);
		sprintf(szCasual, "%d", param->roadRightB[i]);
		third = xml_AddItem(second, szCasual2, szCasual);
		if(third == NULL)
			return 0;
	}


//////////////////////////////////////////////////////////////////////////
	return 1;
}

//函数功能		依据给定的节点数据构建XML文件
//boot			[in]根结点
//param			[in]系统配置参数
//返回值：		成功返回1，失败返回0
int		Xml_MakeSysCfgXml(S_XMLItem *root,XMLNode *node)
{
	S_XMLItem	*SystemItem;					//系统配置层结点
	S_XMLItem	*first, *second;				//系统配置层以下各层结点
	int i=0;

	SystemItem = xml_AddItem(root, "SystemConfig", NULL);
	if(SystemItem == NULL)
		return 0;

	first = xml_AddItem(SystemItem, "SystemParam", NULL);		//系统参数根结点
	if(first == NULL)
		return 0;

	//依据指定的节点数据添加节点,如果遇到一个空名字则认为结束
	while(node[i].name[0]== '\0')
	{
		second = xml_AddItem(first, node[i].name, node[i].val);
		if(second == NULL)
			return 0;
	}
	
	return 1;
}

//函数功能		生成系统配置参数XML信息
//boot			[in]根结点
//param			[in]系统配置参数
//返回值：		成功返回1，失败返回0
int		Xml_MakeSystemConfigXml(S_XMLItem *root, const SSystemParam *param)
{
	S_XMLItem	*SystemItem;					//系统配置层结点
	S_XMLItem	*first, *second;				//系统配置层以下各层结点

	char	szCasual[NODEVALUE_MAX_LENGTH];
	
	SystemItem = xml_AddItem(root, "SystemConfig", NULL);
	if(SystemItem == NULL)
		return 0;

	first = xml_AddItem(SystemItem, "SystemParam", NULL);		//系统参数根结点
	if(first == NULL)
		return 0;


	strcpy(szCasual, param->devInfo);
	second = xml_AddItem(first, "DevInfo", szCasual);
	if(second == NULL)
		return 0;

	sprintf(szCasual, "%d", param->imgUpManner);
	second = xml_AddItem(first, "ImgUpManner", szCasual);
	if(second == NULL)
		return 0;

	strcpy(szCasual, param->FTPIP);
	second = xml_AddItem(first, "FTPIP", szCasual);
	if(second == NULL)
		return 0;

	strcpy(szCasual, param->FTPUser);
	second = xml_AddItem(first, "FTPUser", szCasual);
	if(second == NULL)
		return 0;

	strcpy(szCasual, param->FTPPWord);
	second = xml_AddItem(first, "FTPPW", szCasual);
	if(second == NULL)
		return 0;

	strcpy(szCasual, param->UDPUpIP);
	second = xml_AddItem(first, "UDPUPIP", szCasual);
	if(second == NULL)
		return 0;

	sprintf(szCasual, "%d", param->UDPUpPort);
	second = xml_AddItem(first, "UDPUPPort", szCasual);
	if(second == NULL)
		return 0;

	strcpy(szCasual, param->chargeIP);
	second = xml_AddItem(first, "ChargeIP", szCasual);
	if(second == NULL)
		return 0;

	sprintf(szCasual, "%d", param->chargePort);
	second = xml_AddItem(first, "ChargePort", szCasual);
	if(second == NULL)
		return 0;

	strcpy(szCasual, param->posIP);
	second = xml_AddItem(first, "PosIP", szCasual);
	if(second == NULL)
		return 0;

	sprintf(szCasual, "%d", param->posPort);
	second = xml_AddItem(first, "PosPort", szCasual);
	if(second == NULL)
		return 0;

	sprintf(szCasual, "%04d%02d%02d%02d%02d%02d", param->curTime.year, param->curTime.month, param->curTime.day,
		param->curTime.hour, param->curTime.minute, param->curTime.second);
	second = xml_AddItem(first, "Time", szCasual);
	if(second == NULL)
		return 0;

	sprintf(szCasual, "%d", param->NTPVerifyTime);
	second = xml_AddItem(first, "UseNTP", szCasual);
	if(second == NULL)
		return 0;

	strcpy(szCasual, param->NTPSever);
	second = xml_AddItem(first, "NTPIP", szCasual);
	if(second == NULL)
		return 0;

	sprintf(szCasual, "%d", param->NTPInterval);
	second = xml_AddItem(first, "NTPInterval", szCasual);
	if(second == NULL)
		return 0;

	first = xml_AddItem(SystemItem, "UpParam", NULL);		//升级参数根结点
	if(first == NULL)
		return 0;



	sprintf(szCasual, "%d", param->reserve1);
	first = xml_AddItem(SystemItem, "Reserve1", szCasual);
	if(first == NULL)
		return 0;

	sprintf(szCasual, "%d", param->reserve2);
	first = xml_AddItem(SystemItem, "Reserve2", szCasual);
	if(first == NULL)
		return 0;

	first = xml_AddItem(SystemItem, "Reserve3", param->reserve3);
	if(first == NULL)
		return 0;

	first = xml_AddItem(SystemItem, "Reserve4", param->reserve4);
	if(first == NULL)
		return 0;

	return 1;
}

//函数功能		生成图像参数XML信息
//boot			[in]根结点
//param			[in]图像参数
//返回值：		成功返回1，失败返回0
int		Xml_MakeImageParamXml(S_XMLItem *root, const SImageParam *param)
{
	S_XMLItem	*ImageItem;						//图像参数层结点
	S_XMLItem	*first, *second;		//图像参数层以下各层结点

	char	szCasual[NODEVALUE_MAX_LENGTH];

	ImageItem = xml_AddItem(root, "ImageParam", NULL);
	if(ImageItem == NULL)
		return 0;

	first = xml_AddItem(ImageItem, "ImageConfig", NULL);		//图像配置根结点
	if(first == NULL)
		return 0;


	sprintf(szCasual, "%d", param->capWidth);
	second = xml_AddItem(first, "CapImgWidth", szCasual);
	if(second == NULL)
		return 0;

	sprintf(szCasual, "%d", param->capHeight);
	second = xml_AddItem(first, "CapImgHeight", szCasual);
	if(second == NULL)
		return 0;

	sprintf(szCasual, "%d", param->videoWidth);
	second = xml_AddItem(first, "VideoWidth", szCasual);
	if(second == NULL)
		return 0;

	sprintf(szCasual, "%d", param->videoHeight);
	second = xml_AddItem(first, "VideoHeight", szCasual);
	if(second == NULL)
		return 0;

	sprintf(szCasual, "%d", param->capExposalTime);
	second = xml_AddItem(first, "CapExposalTime", szCasual);
	if(second == NULL)
		return 0;

	sprintf(szCasual, "%d", param->videoExposalTime);
	second = xml_AddItem(first, "VideoExposalTime", szCasual);
	if(second == NULL)
		return 0;

	sprintf(szCasual, "%d", param->maxPlus);
	second = xml_AddItem(first, "MaxPlus", szCasual);
	if(second == NULL)
		return 0;

	first = xml_AddItem(ImageItem, "ImageDeal", NULL);		//图像处理根结点
	if(first == NULL)
		return 0;

	sprintf(szCasual, "%d", param->gammaRevise);
	second = xml_AddItem(first, "GammaRevise", szCasual);
	if(second == NULL)
		return 0;

	sprintf(szCasual, "%d", param->lighteness);
	second = xml_AddItem(first, "Lighteness", szCasual);
	if(second == NULL)
		return 0;

	sprintf(szCasual, "%d", param->acutance);
	second = xml_AddItem(first, "Acutance", szCasual);
	if(second == NULL)
		return 0;

	sprintf(szCasual, "%d", param->saturation);
	second = xml_AddItem(first, "Saturation", szCasual);
	if(second == NULL)
		return 0;

	sprintf(szCasual, "%d", param->pushUpPerss);
	second = xml_AddItem(first, "PushUpPerss", szCasual);
	if(second == NULL)
		return 0;

	sprintf(szCasual, "%d", param->pushDownPerss);
	second = xml_AddItem(first, "PushDownPerss", szCasual);
	if(second == NULL)
		return 0;

	sprintf(szCasual, "%d", param->pushDownThre);
	second = xml_AddItem(first, "PushDownThre", szCasual);
	if(second == NULL)
		return 0;

	sprintf(szCasual, "%d", param->pushTimeThre);
	second = xml_AddItem(first, "PushTimeThre", szCasual);
	if(second == NULL)
		return 0;

	sprintf(szCasual, "%d", param->imageQuality);
	second = xml_AddItem(first, "ImageQuality", szCasual);
	if(second == NULL)
		return 0;

	sprintf(szCasual, "%d", param->imageReversal);
	second = xml_AddItem(first, "ImageReversal", szCasual);
	if(second == NULL)
		return 0;

	first = xml_AddItem(ImageItem, "LightDeal", NULL);		//调光处理根结点
	if(first == NULL)
		return 0;

	sprintf(szCasual, "%d", param->reserve1);
	first = xml_AddItem(ImageItem, "Reserve1", szCasual);
	if(first == NULL)
		return 0;

	sprintf(szCasual, "%d", param->reserve2);
	first = xml_AddItem(ImageItem, "Reserve2", szCasual);
	if(first == NULL)
		return 0;

	first = xml_AddItem(ImageItem, "Reserve3", param->reserve3);
	if(first == NULL)
		return 0;

	first = xml_AddItem(ImageItem, "Reserve4", param->reserve4);
	if(first == NULL)
		return 0;

	first = xml_AddItem(ImageItem, "HeadTailParam", NULL);		//图像配置根结点
	if(first == NULL)
		return 0;

	//lxreference 2014-6-6 顺逆光参数
	//PBTL = PlateBackToLight
	sprintf(szCasual, "%d", param->PlateBackToLight_En);
	second = xml_AddItem(first, "PBTL_En", szCasual);
	if(second == NULL)
		return 0;

	sprintf(szCasual, "%d", param->PlateBackToLight_Light);
	second = xml_AddItem(first, "PBTL_Light", szCasual);
	if(second == NULL)
		return 0;

	sprintf(szCasual, "%ld", param->PlateBackToLight_Begin);
	second = xml_AddItem(first, "PBTL_Begin", szCasual);
	if(second == NULL)
		return 0;

	sprintf(szCasual, "%ld", param->PlateBackToLight_End);
	second = xml_AddItem(first, "PBTL_End", szCasual);
	if(second == NULL)
		return 0;

	sprintf(szCasual, "%d", param->PlateBackToLight_Rect.top);
	second = xml_AddItem(first, "PBTL_top", szCasual);
	if(second == NULL)
		return 0;

	sprintf(szCasual, "%d", param->PlateBackToLight_Rect.bottom);
	second = xml_AddItem(first, "PBTL_bottom", szCasual);
	if(second == NULL)
		return 0;

	sprintf(szCasual, "%d", param->PlateBackToLight_Rect.left);
	second = xml_AddItem(first, "PBTL_left", szCasual);
	if(second == NULL)
		return 0;

	sprintf(szCasual, "%d", param->PlateBackToLight_Rect.right);
	second = xml_AddItem(first, "PBTL_right", szCasual);
	if(second == NULL)
		return 0;

	sprintf(szCasual, "%d", param->PlateBackToLight_LightPercent);
	second = xml_AddItem(first, "PBTL_LightPercent", szCasual);
	if(second == NULL)
		return 0;

	//

	sprintf(szCasual, "%d", param->PlateFaceToLight_En);
	second = xml_AddItem(first, "PFTL_En", szCasual);
	if(second == NULL)
		return 0;

	sprintf(szCasual, "%d", param->PlateFaceToLight_Light);
	second = xml_AddItem(first, "PFTL_Light", szCasual);
	if(second == NULL)
		return 0;

	sprintf(szCasual, "%ld", param->PlateFaceToLight_Begin);
	second = xml_AddItem(first, "PFTL_Begin", szCasual);
	if(second == NULL)
		return 0;

	sprintf(szCasual, "%ld", param->PlateFaceToLight_End);
	second = xml_AddItem(first, "PFTL_End", szCasual);
	if(second == NULL)
		return 0;

	sprintf(szCasual, "%d", param->PlateFaceToLight_Rect.top);
	second = xml_AddItem(first, "PFTL_top", szCasual);
	if(second == NULL)
		return 0;

	sprintf(szCasual, "%d", param->PlateFaceToLight_Rect.bottom);
	second = xml_AddItem(first, "PFTL_bottom", szCasual);
	if(second == NULL)
		return 0;

	sprintf(szCasual, "%d", param->PlateFaceToLight_Rect.left);
	second = xml_AddItem(first, "PFTL_left", szCasual);
	if(second == NULL)
		return 0;

	sprintf(szCasual, "%d", param->PlateFaceToLight_Rect.right);
	second = xml_AddItem(first, "PFTL_right", szCasual);
	if(second == NULL)
		return 0;

	sprintf(szCasual, "%d", param->PlateFaceToLight_LightPercent);
	second = xml_AddItem(first, "PFTL_LightPercent", szCasual);
	if(second == NULL)
		return 0;

	return 1;
}

//函数功能		生成调试信息参数XML信息
//boot			[in]根结点
//param			[in]图像参数
//返回值：		成功返回1，失败返回0
int		Xml_MakeDebugParamXml(S_XMLItem *root, const SUDPDebug *param)
{
	S_XMLItem	*pSideItem;						//参数层结点
	S_XMLItem	*first;				//参数层以下各层结点

	char	szCasual[NODEVALUE_MAX_LENGTH];

	pSideItem = xml_AddItem(root, "DebugParam", NULL);
	if(pSideItem == NULL)
		return 0;

	sprintf(szCasual, "%s", param->UDPUpIP);
	first = xml_AddItem(pSideItem, "UDPUpIP", szCasual);
	if(first == NULL)
		return 0;

	sprintf(szCasual, "%d", param->UDPUpPort);
	first = xml_AddItem(pSideItem, "UDPUpPort", szCasual);
	if(first == NULL)
		return 0;

	sprintf(szCasual, "%d", param->DebugFlag);
	first = xml_AddItem(pSideItem, "DebugFlag", szCasual);
	if(first == NULL)
		return 0;

	sprintf(szCasual, "%d", param->RecDebugFlag);
	first = xml_AddItem(pSideItem, "RecDebugFlag", szCasual);
	if(first == NULL)
		return 0;

	return 1;
}

//函数功能		生成侧装卡口参数XML信息
//boot			[in]根结点
//param			[in]图像参数
//返回值：		成功返回1，失败返回0
int		Xml_MakeSideParamXml(S_XMLItem *root, const s_side_param *param)
{
	S_XMLItem	*pSideItem;						//参数层结点
	S_XMLItem	*first;				//参数层以下各层结点

	char	szCasual[NODEVALUE_MAX_LENGTH];

	pSideItem = xml_AddItem(root, "SideParam", NULL);
	if(pSideItem == NULL)
		return 0;

	sprintf(szCasual, "%d", param->saveFlag);
	first = xml_AddItem(pSideItem, "saveFlag", szCasual);
	if(first == NULL)
		return 0;

	sprintf(szCasual, "%d", param->beginRoad);
	first = xml_AddItem(pSideItem, "beginRoad", szCasual);
	if(first == NULL)
		return 0;

	sprintf(szCasual, "%d", param->runHeading);
	first = xml_AddItem(pSideItem, "runHeading", szCasual);
	if(first == NULL)
		return 0;
#ifndef WIN32
	sprintf(szCasual, "%d", param->saveSpace);
	first = xml_AddItem(pSideItem, "saveSpace", szCasual);
	if(first == NULL)
		return 0;
#endif
	return 1;
}

//函数功能		生成抓拍分辨率XML信息
//boot			[in]根结点
//width			[in]抓拍宽
//height		[in]抓拍高
//返回值：		成功返回1，失败返回0
int		Xml_MakeCapXml(S_XMLItem *root, int32 width, int32 height)
{
	S_XMLItem	*ImageItem;						//图像参数层结点
	S_XMLItem	*first, *second;				//图像参数层以下各层结点

	char	szCasual[NODEVALUE_MAX_LENGTH];
	
	ImageItem = xml_AddItem(root, "ImageParam", NULL);
	if(ImageItem == NULL)
		return 0;

	first = xml_AddItem(ImageItem, "ImageConfig", NULL);		//图像配置根结点
	if(first == NULL)
		return 0;


	sprintf(szCasual, "%d", width);
	second = xml_AddItem(first, "CapImgWidth", szCasual);
	if(second == NULL)
		return 0;

	sprintf(szCasual, "%d", height);
	second = xml_AddItem(first, "CapImgHeight", szCasual);
	if(second == NULL)
		return 0;

	return 1;
}

//函数功能		构建IP地址XML信息
//boot			[in]根结点
//ip			[in]ip地址
//mask			[in]子网掩码
//gate			[in]网关
//mac			[in]MAC地址
//返回值：		成功返回1，失败返回0
int		Xml_MakeIPXml(S_XMLItem *root, const char *ip, const char *mask, const char *gate)
{
	S_XMLItem	*IPItem;						//IP信息结点
	S_XMLItem	*first;

	IPItem = xml_AddItem(root, "IPInfo", NULL);
	if(IPItem == NULL)
		return 0;

	first = xml_AddItem(IPItem, "IPAddr", (char*)ip);
	if(first == NULL)
		return 0;

	first = xml_AddItem(IPItem, "SubMask", (char*)mask);
	if(first == NULL)
		return 0;

	first = xml_AddItem(IPItem, "Gateway", (char*)gate);
	if(first == NULL)
		return 0;

	return 1;
}

//函数功能		生成拍摄图片XML尾部信息
//boot			[in]根结点
//param			[in]尾部信息参数
//返回值：		成功返回1，失败返回0
int		Xml_MakeTailInfoXml(S_XMLItem *root, const STailInfo *param)
{
	S_XMLItem	*TailItem;						//尾部信息层结点
	S_XMLItem	*first, *second;				//尾部信息层以下各层结点

	char	szCasual[NODEVALUE_MAX_LENGTH];
	
	TailItem = xml_AddItem(root, "TailInfo", NULL);
	if(TailItem == NULL)
		return 0;

	first = xml_AddItem(TailItem, "DevInfo", param->devInfo);
	if(first == NULL)
		return 0;

	sprintf(szCasual, "%d", param->curState);
	first = xml_AddItem(TailItem, "CurState", szCasual);
	if(first == NULL)
		return 0;

	first = xml_AddItem(TailItem, "DevIP", param->ip);
	if(first == NULL)
		return 0;

	first = xml_AddItem(TailItem, "CapTime", param->capTime);
	if(first == NULL)
		return 0;

	first = xml_AddItem(TailItem, "PlateStr", param->plateStr);
	if(first == NULL)
		return 0;

	first = xml_AddItem(TailItem, "PlateColor", param->plateColor);
	if(first == NULL)
		return 0;


	sprintf(szCasual, "%d", param->recWeight);
	first = xml_AddItem(TailItem, "RecWeight", szCasual);
	if(first == NULL)
		return 0;

	first = xml_AddItem(TailItem, "PlateRect", NULL);
	if(first == NULL)
		return 0;

	sprintf(szCasual, "%d", param->plateRect.top);
	second = xml_AddItem(first, "Top", szCasual);
	if(second == NULL)
		return 0;

	sprintf(szCasual, "%d", param->plateRect.bottom);
	second = xml_AddItem(first, "Bottom", szCasual);
	if(second == NULL)
		return 0;

	sprintf(szCasual, "%d", param->plateRect.left);
	second = xml_AddItem(first, "Left", szCasual);
	if(second == NULL)
		return 0;

	sprintf(szCasual, "%d", param->plateRect.right);
	second = xml_AddItem(first, "Right", szCasual);
	if(second == NULL)
		return 0;

	first = xml_AddItem(TailItem, "PlateRect2", NULL);	//坐标系变换过的车牌区域
	if(first == NULL)
		return 0;

	sprintf(szCasual, "%d", param->plateRect2.top);
	second = xml_AddItem(first, "Top", szCasual);
	if(second == NULL)
		return 0;

	sprintf(szCasual, "%d", param->plateRect2.bottom);
	second = xml_AddItem(first, "Bottom", szCasual);
	if(second == NULL)
		return 0;

	sprintf(szCasual, "%d", param->plateRect2.left);
	second = xml_AddItem(first, "Left", szCasual);
	if(second == NULL)
		return 0;

	sprintf(szCasual, "%d", param->plateRect2.right);
	second = xml_AddItem(first, "Right", szCasual);
	if(second == NULL)
		return 0;

	sprintf(szCasual, "%d", param->carDirection);
	first = xml_AddItem(TailItem, "CarDirection", szCasual);
	if(first == NULL)
		return 0;

	sprintf(szCasual, "%d", param->matchFlag);
	first = xml_AddItem(TailItem, "MatchFlag", szCasual);
	if(first == NULL)
		return 0;

	sprintf(szCasual, "%d", param->capManner);
	first = xml_AddItem(TailItem, "CapManner", szCasual);
	if(first == NULL)
		return 0;
	//车牌类型
	sprintf(szCasual, "%d", param->carType);
	first = xml_AddItem(TailItem, "carType", szCasual);
	if(first == NULL)
		return 0;

	return 1;
}

//函数功能		生成拍摄图片XML尾部信息
//boot			[in]根结点
//param			[in]测速信息参数
//返回值：		成功返回1，失败返回0
int	Xml_MakeSpeedInfoXml(S_XMLItem *root, const SSpeedInfo *param)
{
	S_XMLItem	*SpeedItem;						//尾部信息层结点
	S_XMLItem	*first;				//尾部信息层以下各层结点

	char	szCasual[NODEVALUE_MAX_LENGTH];

	SpeedItem = xml_AddItem(root, "SpeedInfo", NULL);
	if(SpeedItem == NULL)
		return 0;

	first = xml_AddItem(SpeedItem, "DevInfo", param->devInfo);
	if(first == NULL)
		return 0;

	first = xml_AddItem(SpeedItem, "CapTime", param->capTime);
	if(first == NULL)
		return 0;

	first = xml_AddItem(SpeedItem, "PlateStr", param->plateStr);
	if(first == NULL)
		return 0;

	first = xml_AddItem(SpeedItem, "PlateColor", param->plateColor);
	if(first == NULL)
		return 0;

	sprintf(szCasual, "%d", param->resNo);
	first = xml_AddItem(SpeedItem, "ResNo", szCasual);
	if(first == NULL)
		return 0;
	sprintf(szCasual, "%d", param->lostCount);
	first = xml_AddItem(SpeedItem, "LostCount", szCasual);
	if(first == NULL)
		return 0;
	return 1;
}

/* 生成视频流模式下图片的尾部信息
 * 返回值: 1-成功, 0-失败
 */
int		Xml_MakeTailInfoXml_VideoMode(S_XMLItem *root, const STailInfo_VideoMode *param)
{
	S_XMLItem	*TailItem;						//尾部信息层结点
	S_XMLItem	*first;							//尾部信息层以下各层结点

	char	szCasual[NODEVALUE_MAX_LENGTH] = "";

	TailItem = xml_AddItem(root, "TailInfo_VideoMode", NULL);
	if(TailItem == NULL)
		return 0;

	first = xml_AddItem(TailItem, "DevInfo", param->devInfo);
	if(first == NULL)
		return 0;

	first = xml_AddItem(TailItem, "DevIP", param->ip);
	if(first == NULL)
		return 0;

	first = xml_AddItem(TailItem, "CapTime", param->capTime);
	if(first == NULL)
		return 0;

	sprintf(szCasual, "%d", param->IOFlag);
	first = xml_AddItem(TailItem, "IOFlag", szCasual);
	if(first == NULL)
		return 0;

	return 1;
}


//函数功能		生成当前图片参数的XML信息
//boot			[in]根结点
//param			[in]尾部信息参数
//返回值：		成功返回1，失败返回0
int		Xml_MakeCurPicParamXml(S_XMLItem *root, const SCurPicParam *param)
{
	S_XMLItem	*TailItem;						//尾部信息层结点
	S_XMLItem	*first;				//尾部信息层以下各层结点

	char	szCasual[NODEVALUE_MAX_LENGTH];
	
	TailItem = xml_AddItem(root, "CurPicParam", NULL);
	if(TailItem == NULL)
		return 0;

	sprintf(szCasual, "%d", param->limit);
	first = xml_AddItem(TailItem, "limit", szCasual);
	if(first == NULL)
		return 0;
	sprintf(szCasual, "%d", param->num);
	first = xml_AddItem(TailItem, "num", szCasual);
	if(first == NULL)
		return 0;
	sprintf(szCasual, "%d", param->feed_back);
	first = xml_AddItem(TailItem, "feed_back", szCasual);
	if(first == NULL)
		return 0;
	sprintf(szCasual, "%d", param->shutter);
	first = xml_AddItem(TailItem, "shutter", szCasual);
	if(first == NULL)
		return 0;
	sprintf(szCasual, "%d", param->adj_type);
	first = xml_AddItem(TailItem, "adj_type", szCasual);
	if(first == NULL)
		return 0;

	sprintf(szCasual, "%d", param->curCalcLight);
	first = xml_AddItem(TailItem, "curCalcLight", szCasual);
	if(first == NULL)
		return 0;

	sprintf(szCasual, "%d", param->curRefLight);
	first = xml_AddItem(TailItem, "curRefLight", szCasual);
	if(first == NULL)
		return 0;

	sprintf(szCasual, "%d", param->curGlobleCapLight);
	first = xml_AddItem(TailItem, "curGlobleCapLight", szCasual);
	if(first == NULL)
		return 0;

	sprintf(szCasual, "%d", param->curZoneCapLight);
	first = xml_AddItem(TailItem, "curZoneCapLight", szCasual);
	if(first == NULL)
		return 0;

	sprintf(szCasual, "%d", param->curGlobleLightPrecent);
	first = xml_AddItem(TailItem, "curGlobleLightPrecent", szCasual);
	if(first == NULL)
		return 0;

	sprintf(szCasual, "%d", param->curZoneLightPrecent);
	first = xml_AddItem(TailItem, "curZoneLightPrecent", szCasual);
	if(first == NULL)
		return 0;

	sprintf(szCasual, "%d", param->curGainNo);
	first = xml_AddItem(TailItem, "curGainNo", szCasual);
	if(first == NULL)
		return 0;


	return 1;
}

//函数功能		生成拍摄图片XML尾部信息
//boot			[in]根结点
//param			[in]TFTP尾部信息参数
//返回值：		成功返回1，失败返回0
int		Xml_MakeTFTPTailInfoXml(S_XMLItem *root, const STFTPTailInfo *param)
{
	S_XMLItem	*TailItem;						//尾部信息层结点
	S_XMLItem	*first;							//尾部信息层以下各层结点

	char	szCasual[NODEVALUE_MAX_LENGTH];
	
	TailItem = xml_AddItem(root, "HaveImage", NULL);
	if(TailItem == NULL)
		return 0;


	sprintf(szCasual, "%d", param->bigImage);
	first = xml_AddItem(TailItem, "BigImage", szCasual);
	if(first == NULL)
		return 0;


	sprintf(szCasual, "%d", param->smallImage);
	first = xml_AddItem(TailItem, "SmallImage", szCasual);
	if(first == NULL)
		return 0;

	sprintf(szCasual, "%d", param->binImage);
	first = xml_AddItem(TailItem, "BinImage", szCasual);
	if(first == NULL)
		return 0;

	return 1;
}

//函数功能		生成相机状态XML信息
//boot			[in]根结点
//param			[in]相机状态结构
//返回值：		成功返回1，失败返回0
int		Xml_MakeCammerStateInfoXml(S_XMLItem *root, const SCammerState *param)
{
	S_XMLItem	*StateItem;							//状态层结点
	S_XMLItem	*first;								//状态层以下各层结点

	char	szCasual[NODEVALUE_MAX_LENGTH];
	
	StateItem = xml_AddItem(root, "CammerState", NULL);
	if(StateItem == NULL)
		return 0;


	sprintf(szCasual, "%d", param->BpParam);
	first = xml_AddItem(StateItem, "BpParam", szCasual);
	if(first == NULL)
		return 0;


	sprintf(szCasual, "%d", param->colorParam);
	first = xml_AddItem(StateItem, "ColorParam", szCasual);
	if(first == NULL)
		return 0;

	sprintf(szCasual, "%d", param->plateList);
	first = xml_AddItem(StateItem, "PlateList", szCasual);
	if(first == NULL)
		return 0;

	sprintf(szCasual, "%d", param->cammerHead);
	first = xml_AddItem(StateItem, "CammerHead", szCasual);
	if(first == NULL)
		return 0;

	sprintf(szCasual, "%d", param->clock);
	first = xml_AddItem(StateItem, "Clock", szCasual);
	if(first == NULL)
		return 0;


	sprintf(szCasual, "%d", param->SDCard);
	first = xml_AddItem(StateItem, "SDCard", szCasual);
	if(first == NULL)
		return 0;

	sprintf(szCasual, "%d", param->SPIFLASH);
	first = xml_AddItem(StateItem, "SPIFLASH", szCasual);
	if(first == NULL)
		return 0;

	sprintf(szCasual, "%d", param->memoryChip);
	first = xml_AddItem(StateItem, "MemoryChip", szCasual);
	if(first == NULL)
		return 0;
	//识别库版本
	first = xml_AddItem(StateItem, "cCarLibVer", param->cCarLibVer);
	if(first == NULL)
		return 0;
	//BP参数版本
	first = xml_AddItem(StateItem, "cBpParamVer", param->cBpParamVer);
	if(first == NULL)
		return 0;
	//颜色表版本
	first = xml_AddItem(StateItem, "cRecColorVer", param->cRecColorVer);
	if(first == NULL)
		return 0;

	return 1;
}

//函数功能		生成XML的字符串
//string		[in]字符串首字址
//BufferLength	[in]缓冲区长度
//返回值：		成功返回字符串长度，失败返回-1
int		Xml_MakeXmlString(char *string, int BufferLength)
{
	int		length ;

//	memset(string, 0, BufferLength);
	length = xml_saveString(string, BufferLength);
	if(length >= 0)
	{
		string[length] = 0;
	}
	else
	{
		return -1;
	}

	return length;
}

//函数功能		生成信息叠加XML
//boot			[in]根结点
//param			[in]相机状态结构
//返回值：		成功返回1，失败返回0
int		Xml_MakeOverParamXml(S_XMLItem *root, const s_dynamic_over_info *param)
{
	S_XMLItem	*RecItem;						//识别层结点
	S_XMLItem	*first, *second;		//识别层以下各层结点
	char	szCasual[NODEVALUE_MAX_LENGTH];
	int index = 0;
	char xmlName[NODEVALUE_MAX_LENGTH] = {0};

	RecItem = xml_AddItem(root, "OverInfo", NULL);
	if(RecItem == NULL)
		return 0;

	sprintf(szCasual, "%d", param->m_iDynamicOverMessNum);
	first = xml_AddItem(RecItem, "MessNum", szCasual);
	if(first == NULL)
		return 0;

	sprintf(szCasual, "%d", param->m_iDynamicOverStand);
	first = xml_AddItem(RecItem, "Stand", szCasual);
	if(first == NULL)
		return 0;

	if(param->m_iDynamicOverMessNum < 1 || param->m_iDynamicOverMessNum > 8)
		return 0;

	for(index = 0; index < param->m_iDynamicOverMessNum; index++)
	{
		sprintf(xmlName, "OverMess%d", index+1);
		first = xml_AddItem(RecItem, xmlName, NULL);
		if(first == NULL)
			return 0;

		sprintf(szCasual, "%d", param->m_pOver_mess[index].iLeftDis);
		second = xml_AddItem(first, "LeftDis", szCasual);
		if(second == NULL)
			return 0;

		sprintf(szCasual, "%d", param->m_pOver_mess[index].iTopDis);
		second = xml_AddItem(first, "TopDis", szCasual);
		if(second == NULL)
			return 0;

		sprintf(szCasual, "%d", param->m_pOver_mess[index].iFont);
		second = xml_AddItem(first, "Font", szCasual);
		if(second == NULL)
			return 0;

		sprintf(szCasual, "%d", param->m_pOver_mess[index].iFontSize);
		second = xml_AddItem(first, "FontSize", szCasual);
		if(second == NULL)
			return 0;

		sprintf(szCasual, "%d", param->m_pOver_mess[index].iEdgeColor);
		second = xml_AddItem(first, "EdgeColor", szCasual);
		if(second == NULL)
			return 0;

		sprintf(szCasual, "%d", param->m_pOver_mess[index].iCharColor);
		second = xml_AddItem(first, "CharColor", szCasual);
		if(second == NULL)
			return 0;

		sprintf(szCasual, "%d", param->m_pOver_mess[index].iBackColor);
		second = xml_AddItem(first, "BackColor", szCasual);
		if(second == NULL)
			return 0;

		sprintf(szCasual, "%d", param->m_pOver_mess[index].iSpace);
		second = xml_AddItem(first, "Space", szCasual);
		if(second == NULL)
			return 0;

		strcpy(szCasual, param->m_pOver_mess[index].szText);
		second = xml_AddItem(first, "Text", szCasual);
		if(second == NULL)
			return 0;
	}

	sprintf(szCasual, "%d", param->iBanisterFlag);
	first = xml_AddItem(RecItem, "BanisterFlag", szCasual);
	if(first == NULL)
		return 0;
	if(param->iBanisterFlag < 0 || param->iBanisterFlag > 2)
		return 0;

	return 1;
}


///////////////////////////////////////////////////////////////////////////
//解析部分
//////////////////////////////////////////////////////////////////////////
//函数功能		从XML信息中解析出系统配置参数
//XMLString		[in]XML信息
//len			[in]XML信息长度
//param			[out]系统配置参数
//返回值：		成功返回1，失败返回0
int32	Xml_JieXiSystemConfigXml(const char *XMLString, const int32 len, SSystemParam *param)
{
	char	result[NODEVALUE_MAX_LENGTH]={0};
	char	time[5]={0};
	byte	flag = 0;
		
	if(xml_FindValue(XMLString, len, "xml/SystemConfig/SystemParam/DevInfo", result) == 1)
	{
		strcpy(param->devInfo, result);
		flag = 1;
	}

	if(xml_FindValue(XMLString, len, "xml/SystemConfig/SystemParam/ImgUpManner", result) == 1)
	{
		param->imgUpManner = atoi(result);
		flag = 1;
	}

	if(xml_FindValue(XMLString, len, "xml/SystemConfig/SystemParam/FTPIP", result) == 1)
	{
		strcpy(param->FTPIP, result);
		flag = 1;
	}

	if(xml_FindValue(XMLString, len, "xml/SystemConfig/SystemParam/FTPUser", result) == 1)
	{
		strcpy(param->FTPUser, result);
		flag = 1;
	}

	if(xml_FindValue(XMLString, len, "xml/SystemConfig/SystemParam/FTPPW", result) == 1)
	{
		strcpy(param->FTPPWord, result);
		flag = 1;
	}
	
	if(xml_FindValue(XMLString, len, "xml/SystemConfig/SystemParam/UDPUPIP", result) == 1)
	{
		strcpy(param->UDPUpIP, result);
		flag = 1;
	}
	
	if(xml_FindValue(XMLString, len, "xml/SystemConfig/SystemParam/UDPUPPort", result) == 1)
	{
		param->UDPUpPort = atoi(result);
		flag = 1;
	}

	if(xml_FindValue(XMLString, len, "xml/SystemConfig/SystemParam/ChargeIP", result) == 1)
	{
		strcpy(param->chargeIP, result);
		flag = 1;
	}
	
	if(xml_FindValue(XMLString, len, "xml/SystemConfig/SystemParam/ChargePort", result) == 1)
	{
		param->chargePort = atoi(result);
		flag = 1;
	}

	if(xml_FindValue(XMLString, len, "xml/SystemConfig/SystemParam/PosIP", result) == 1)
	{
		strcpy(param->posIP, result);
		flag = 1;
	}
	
	if(xml_FindValue(XMLString, len, "xml/SystemConfig/SystemParam/PosPort", result) == 1)
	{
		param->posPort = atoi(result);
		flag = 1;
	}

	if(xml_FindValue(XMLString, len, "xml/SystemConfig/SystemParam/Time", result) == 1)
	{
		memcpy(time, result, 4);
		time[4] = '\0';
		param->curTime.year = atoi(time);

		memcpy(time, &(result[4]), 2);
		time[2] = '\0';
		param->curTime.month = atoi(time);

		memcpy(time, &(result[6]), 2);
		time[2] = '\0';
		param->curTime.day = atoi(time);

		memcpy(time, &(result[8]), 2);
		time[2] = '\0';
		param->curTime.hour = atoi(time);

		memcpy(time, &(result[10]), 2);
		time[2] = '\0';
		param->curTime.minute = atoi(time);

		memcpy(time, &(result[12]), 2);
		time[2] = '\0';
		param->curTime.second = atoi(time);

		flag = 1;
	}
		

	if(xml_FindValue(XMLString, len, "xml/SystemConfig/SystemParam/UseNTP", result) == 1)
	{
		param->NTPVerifyTime = atoi(result);
		flag = 1;
	}

	if(xml_FindValue(XMLString, len, "xml/SystemConfig/SystemParam/NTPIP", result) == 1)
	{
		strcpy(param->NTPSever, result);
		flag = 1;
	}

	if(xml_FindValue(XMLString, len, "xml/SystemConfig/SystemParam/NTPInterval", result) == 1)
	{
		param->NTPInterval = atoi(result);
		flag = 1;
	}


	if(xml_FindValue(XMLString, len, "xml/SystemConfig/Reserve1", result) == 1)
	{
		param->reserve1 = atoi(result);
		flag = 1;
	}

	if(xml_FindValue(XMLString, len, "xml/SystemConfig/Reserve2", result) == 1)
	{
		param->reserve2 = atoi(result);
		flag = 1;
	}

	if(xml_FindValue(XMLString, len, "xml/SystemConfig/Reserve3", result) == 1)
	{
		strcpy(param->reserve3, result);
		flag = 1;
	}

	if(xml_FindValue(XMLString, len, "xml/SystemConfig/Reserve4", result) == 1)
	{
		strcpy(param->reserve4, result);
		flag = 1;
	}

	return flag;
}

//函数功能		从XML信息中解析出识别配置参数
//XMLString		[in]XML信息
//len			[in]XML信息长度
//param			[out]识别配置参数
//返回值：		成功返回1，失败返回0
int32	Xml_JieXiRecParamXml(const char *XMLString, const int32 len, SRecParam *param)
{
	char	result[NODEVALUE_MAX_LENGTH]={0};
	char	tmpStr[NODEVALUE_MAX_LENGTH]={0};
	int		i = 0;
	byte	flag = 0;
		
	if(xml_FindValue(XMLString, len, "xml/RecParam/RecRect/Top", result) == 1)
	{
		param->recRect.top = atoi(result);
		flag = 1;
	}

	if(xml_FindValue(XMLString, len, "xml/RecParam/RecRect/Bottom", result) == 1)
	{
		param->recRect.bottom = atoi(result);
		flag = 1;
	}

	if(xml_FindValue(XMLString, len, "xml/RecParam/RecRect/LeftTop", result) == 1)
	{
		param->recRect.leftT = atoi(result);
		flag = 1;
	}

	if(xml_FindValue(XMLString, len, "xml/RecParam/RecRect/LeftBottom", result) == 1)
	{
		param->recRect.leftB = atoi(result);
		flag = 1;
	}
	

	if(xml_FindValue(XMLString, len, "xml/RecParam/RecRect/RightTop", result) == 1)
	{
		param->recRect.rightT = atoi(result);
		flag = 1;
	}

	if(xml_FindValue(XMLString, len, "xml/RecParam/RecRect/RightBottom", result) == 1)
	{
		param->recRect.rightB = atoi(result);
		flag = 1;
	}

	if(xml_FindValue(XMLString, len, "xml/RecParam/OtherParam/CapModel", result) == 1)
	{
		param->capModel = atoi(result);
		flag = 1;
	}

	if(xml_FindValue(XMLString, len, "xml/RecParam/OtherParam/CapDelay", result) == 1)
	{
		param->capDelay = atoi(result);
		flag = 1;
	}

	
	if(xml_FindValue(XMLString, len, "xml/RecParam/OtherParam/LightControl", result) == 1)
	{
		param->lightControl = atoi(result);
		flag = 1;
	}

	if(xml_FindValue(XMLString, len, "xml/RecParam/OtherParam/LightModel", result) == 1)
	{
		param->lightModel = atoi(result);
		flag = 1;
	}

	if(xml_FindValue(XMLString, len, "xml/RecParam/OtherParam/RightChar", result) == 1)
	{
		param->rightChar = atoi(result);
		flag = 1;
	}

	if(xml_FindValue(XMLString, len, "xml/RecParam/OtherParam/InChar", result) == 1)
	{
		strcpy(param->inChar, result);
		flag = 1;
	}

	if(xml_FindValue(XMLString, len, "xml/RecParam/OtherParam/CarDirection", result) == 1)
	{
		param->carDirection = atoi(result);
		flag = 1;
	}

	if(xml_FindValue(XMLString, len, "xml/RecParam/OtherParam/CapPosition", result) == 1)
	{
		param->capPosition = atoi(result);
		flag = 1;
	}

	if(xml_FindValue(XMLString, len, "xml/RecParam/OtherParam/LineReplace", result) == 1)
	{
		param->underLineReplace = atoi(result);
		flag = 1;
	}

	if(xml_FindValue(XMLString, len, "xml/RecParam/OtherParam/RunDec", result) == 1)
	{
		param->runDec = atoi(result);
		flag = 1;
	}

	if(xml_FindValue(XMLString, len, "xml/RecParam/OtherParam/NoPlateDec", result) == 1)
	{
		param->noPlateDec = atoi(result);
		flag = 1;
	}

	if(xml_FindValue(XMLString, len, "xml/RecParam/OtherParam/HorizonSlope", result) == 1)
	{
		param->horizonSlope = atoi(result);
		flag = 1;
	}

	if(xml_FindValue(XMLString, len, "xml/RecParam/OtherParam/VerticalSlope", result) == 1)
	{
		param->verticalSlope = atoi(result);
		flag = 1;
	}

	if(xml_FindValue(XMLString, len, "xml/RecParam/OtherParam/IsPlateMatch", result) == 1)
	{
		param->isPlateMatch = atoi(result);
		flag = 1;
	}

	if(xml_FindValue(XMLString, len, "xml/RecParam/OtherParam/HowPlateMatch", result) == 1)
	{
		param->howPlateMatch = atoi(result);
		flag = 1;
	}

	if(xml_FindValue(XMLString, len, "xml/RecParam/OtherParam/OutBigImg", result) == 1)
	{
		param->outBigImg = atoi(result);
		flag = 1;
	}

	if(xml_FindValue(XMLString, len, "xml/RecParam/OtherParam/OutSmallImg", result) == 1)
	{
		param->outSmallImg = atoi(result);
		flag = 1;
	}

	if(xml_FindValue(XMLString, len, "xml/RecParam/OtherParam/OutBinImg", result) == 1)
	{
		param->outBinImg = atoi(result);
		flag = 1;
	}

	if(xml_FindValue(XMLString, len, "xml/RecParam/OtherParam/CutBig", result) == 1)
	{
		param->cutBig = atoi(result);
		flag = 1;
	}

	if(xml_FindValue(XMLString, len, "xml/RecParam/OtherParam/CutRect/Top", result) == 1)
	{
		param->cutRect.top = atoi(result);
		flag = 1;
	}

	if(xml_FindValue(XMLString, len, "xml/RecParam/OtherParam/CutRect/Bottom", result) == 1)
	{
		param->cutRect.bottom = atoi(result);
		flag = 1;
	}

	if(xml_FindValue(XMLString, len, "xml/RecParam/OtherParam/CutRect/Left", result) == 1)
	{
		param->cutRect.left = atoi(result);
		flag = 1;
	}

	if(xml_FindValue(XMLString, len, "xml/RecParam/OtherParam/CutRect/Right", result) == 1)
	{
		param->cutRect.right = atoi(result);
		flag = 1;
	}


	//////////////////////////////////////////////////////////////////////////
	if(xml_FindValue(XMLString, len, "xml/RecParam/SpeedParam/CameraHeight", result) == 1)
	{
		param->cameraHeight = atoi(result);
		flag = 1;
	}
	if(xml_FindValue(XMLString, len, "xml/RecParam/SpeedParam/NearLength", result) == 1)
	{
		param->nearLength = atoi(result);
		flag = 1;
	}
	if(xml_FindValue(XMLString, len, "xml/RecParam/SpeedParam/FarLength", result) == 1)
	{
		param->farLength = atoi(result);
		flag = 1;
	}
	if(xml_FindValue(XMLString, len, "xml/RecParam/SpeedParam/VdSpeedRevise", result) == 1)
	{
		param->vdSpeedRevise = atoi(result);
		flag = 1;
	}
	////////////////////////////////////////////////////////////////////////// 车道参数

	if(xml_FindValue(XMLString, len, "xml/RecParam/RoadParam/RoadTop", result) == 1)
	{
		param->roadTop = atoi(result);
		flag = 1;
	}
	if(xml_FindValue(XMLString, len, "xml/RecParam/RoadParam/RoadBottom", result) == 1)
	{
		param->roadBottom = atoi(result);
		flag = 1;
	}
	for (i = 0; i < MAX_ROAD_NUM; i++)
	{
		sprintf(tmpStr, "xml/RecParam/RoadParam/RoadFlag/F%d", i); //车道标记
		if(xml_FindValue(XMLString, len, tmpStr, result) == 1)
		{
			param->roadFlag[i] = atoi(result);
			flag = 1;
		}

		sprintf(tmpStr, "xml/RecParam/RoadParam/RoadDirection/F%d", i); //车道方向
		if(xml_FindValue(XMLString, len, tmpStr, result) == 1)
		{
			param->roadDirection[i] = atoi(result);
			flag = 1;
		}

		sprintf(tmpStr, "xml/RecParam/RoadParam/RoadLeftT/RLT%d", i);
		if(xml_FindValue(XMLString, len, tmpStr, result) == 1)
		{
			param->roadLeftT[i] = atoi(result);
			flag = 1;
		}

		sprintf(tmpStr, "xml/RecParam/RoadParam/RoadRightT/RRT%d", i);
		if(xml_FindValue(XMLString, len, tmpStr, result) == 1)
		{
			param->roadRightT[i] = atoi(result);
			flag = 1;
		}

		sprintf(tmpStr, "xml/RecParam/RoadParam/RoadLeftB/RLB%d", i);
		if(xml_FindValue(XMLString, len, tmpStr, result) == 1)
		{
			param->roadLeftB[i] = atoi(result);
			flag = 1;
		}

		sprintf(tmpStr, "xml/RecParam/RoadParam/RoadRightB/RRB%d", i);
		if(xml_FindValue(XMLString, len, tmpStr, result) == 1)
		{
			param->roadRightB[i] = atoi(result);
			flag = 1;
		}
	}

	//////////////////////////////////////////////////////////////////////////


	if(xml_FindValue(XMLString, len, "xml/RecParam/HideParam/NoShieldPlate", result) == 1)
	{
		param->noShieldPlate = atoi(result);
		flag = 1;
	}

	if(xml_FindValue(XMLString, len, "xml/RecParam/HideParam/LightInterval", result) == 1)
	{
		param->lightInterval = atoi(result);
		flag = 1;
	}

	if(xml_FindValue(XMLString, len, "xml/RecParam/HideParam/LightSwitch", result) == 1)
	{
		param->lightSwitch = atoi(result);
		flag = 1;
	}

	if(xml_FindValue(XMLString, len, "xml/RecParam/HideParam/MaxRectCount", result) == 1)
	{
		param->maxRectCount = atoi(result);
		flag = 1;
	}

	if(xml_FindValue(XMLString, len, "xml/RecParam/HideParam/DoublePlateRec", result) == 1)
	{
		param->doublePlateRec = atoi(result);
		flag = 1;
	}

	if(xml_FindValue(XMLString, len, "xml/RecParam/HideParam/DoubleYellowRec", result) == 1)
	{
		param->doubleYellowRec = atoi(result);
		flag = 1;
	}

	if(xml_FindValue(XMLString, len, "xml/RecParam/HideParam/IsDelCharNoise", result) == 1)
	{
		param->isDelCharNoise = atoi(result);
		flag = 1;
	}

	if(xml_FindValue(XMLString, len, "xml/RecParam/plateWidthFlag", result) == 1)
	{
		param->plateWidthFlag = atoi(result);
		flag = 1;
	}
	if(xml_FindValue(XMLString, len, "xml/RecParam/maxPlateWidth", result) == 1)
	{
		param->maxPlateWidth = atoi(result);
		flag = 1;
	}
	if(xml_FindValue(XMLString, len, "xml/RecParam/minPlateWidth", result) == 1)
	{
		param->minPlateWidth = atoi(result);
		flag = 1;
	}

	if(xml_FindValue(XMLString, len, "xml/RecParam/writeParamToTailFlag", result) == 1)
	{
		param->writeParamToTailFlag = atoi(result);
		flag = 1;
	}

	if(xml_FindValue(XMLString, len, "xml/RecParam/white2NoPlateFlag", result) == 1)
	{
		param->white2NoPlateFlag = atoi(result);
		flag = 1;
	}

	if(xml_FindValue(XMLString, len, "xml/RecParam/Reserve2", result) == 1)
	{
		param->reserve2 = atoi(result);
		flag = 1;
	}

	if(xml_FindValue(XMLString, len, "xml/RecParam/Reserve3", result) == 1)
	{
		strcpy(param->reserve3, result);
		flag = 1;
	}

	if(xml_FindValue(XMLString, len, "xml/RecParam/Reserve4", result) == 1)
	{
		strcpy(param->reserve4, result);
		flag = 1;
	}

	///////
	if(xml_FindValue(XMLString, len, "xml/RecParam/RecOutLine/StartX", result) == 1)
	{
		param->RecOutLine[0].x = atoi(result);
		flag = 1;
	}

	if(xml_FindValue(XMLString, len, "xml/RecParam/RecOutLine/StartY", result) == 1)
	{
		param->RecOutLine[0].y = atoi(result);
		flag = 1;
	}

	if(xml_FindValue(XMLString, len, "xml/RecParam/RecOutLine/EndX", result) == 1)
	{
		param->RecOutLine[1].x = atoi(result);
		flag = 1;
	}

	if(xml_FindValue(XMLString, len, "xml/RecParam/RecOutLine/EndY", result) == 1)
	{
		param->RecOutLine[1].y = atoi(result);
		flag = 1;
	}

	///////////////////////////////////////////////////////////////////
	if(xml_FindValue(XMLString, len, "xml/RecParam/DetectStealRecRect/AllEnable", result) == 1)
	{
		param->DetectStealAllEnable = atoi(result);
		flag = 1;
	}
	if(xml_FindValue(XMLString, len, "xml/RecParam/DetectStealRecRect/ChildEnable", result) == 1)
	{
		param->DetectStealChildEnable = atoi(result);
		flag = 1;
	}
	if(xml_FindValue(XMLString, len, "xml/RecParam/DetectStealRecRect/Top", result) == 1)
	{
		param->DetectStealRecRect.top = atoi(result);
		flag = 1;
	}

	if(xml_FindValue(XMLString, len, "xml/RecParam/DetectStealRecRect/Bottom", result) == 1)
	{
		param->DetectStealRecRect.bottom = atoi(result);
		flag = 1;
	}

	if(xml_FindValue(XMLString, len, "xml/RecParam/DetectStealRecRect/LeftTop", result) == 1)
	{
		param->DetectStealRecRect.leftT = atoi(result);
		flag = 1;
	}

	if(xml_FindValue(XMLString, len, "xml/RecParam/DetectStealRecRect/LeftBottom", result) == 1)
	{
		param->DetectStealRecRect.leftB = atoi(result);
		flag = 1;
	}


	if(xml_FindValue(XMLString, len, "xml/RecParam/DetectStealRecRect/RightTop", result) == 1)
	{
		param->DetectStealRecRect.rightT = atoi(result);
		flag = 1;
	}

	if(xml_FindValue(XMLString, len, "xml/RecParam/DetectStealRecRect/RightBottom", result) == 1)
	{
		param->DetectStealRecRect.rightB = atoi(result);
		flag = 1;
	}

	return flag;
}

//函数功能		从XML信息中解析出IP配置参数
//XMLString		[in]XML信息
//len			[in]XML信息长度
//ip			[out]IP地址
//mask			[out]子网掩码
//gate			[out]网关
//返回值：		成功返回1，失败返回0
int32	Xml_JieXiIPXml(const char *XMLString, int32 len, char *ip, char *mask, char *gate)
{
	char	result[NODEVALUE_MAX_LENGTH]={0};
	byte	flag = 0;
		
	if(xml_FindValue(XMLString, len, "xml/IPInfo/IPAddr", result) == 1)
	{
		strcpy(ip, result);
		flag = 1;
	}

	if(xml_FindValue(XMLString, len, "xml/IPInfo/SubMask", result) == 1)
	{
		strcpy(mask, result);
		flag = 1;
	}

	if(xml_FindValue(XMLString, len, "xml/IPInfo/Gateway", result) == 1)
	{
		strcpy(gate, result);
		flag = 1;
	}
	
	return flag;
}

//函数功能		从XML信息中解析出图像配置参数
//XMLString		[in]XML信息
//len			[in]XML信息长度
//param			[out]图像配置参数
//返回值：		成功返回1，失败返回0
int32	Xml_JieXiImageParamXml(const char *XMLString, const int32 len, SImageParam *param)
{
	char	result[NODEVALUE_MAX_LENGTH]={0};
	byte	flag = 0;

	if(xml_FindValue(XMLString, len, "xml/ImageParam/ImageConfig/CapImgWidth", result) == 1)
	{
		param->capWidth = atoi(result);
		flag = 1;
	}

	if(xml_FindValue(XMLString, len, "xml/ImageParam/ImageConfig/CapImgHeight", result) == 1)
	{
		param->capHeight = atoi(result);
		flag = 1;
	}

	if(xml_FindValue(XMLString, len, "xml/ImageParam/ImageConfig/VideoWidth", result) == 1)
	{
		param->videoWidth = atoi(result);
		flag = 1;
	}
	
	if(xml_FindValue(XMLString, len, "xml/ImageParam/ImageConfig/VideoHeight", result) == 1)
	{
		param->videoHeight = atoi(result);
		flag = 1;
	}

	if(xml_FindValue(XMLString, len, "xml/ImageParam/ImageConfig/CapExposalTime", result) == 1)
	{
		param->capExposalTime = atoi(result);
		flag = 1;
	}

	if(xml_FindValue(XMLString, len, "xml/ImageParam/ImageConfig/VideoExposalTime", result) == 1)
	{
		param->videoExposalTime = atoi(result);
		flag = 1;
	}

	if(xml_FindValue(XMLString, len, "xml/ImageParam/ImageConfig/MaxPlus", result) == 1)
	{
		param->maxPlus = atoi(result);
		flag = 1;
	}

	if(xml_FindValue(XMLString, len, "xml/ImageParam/ImageDeal/GammaRevise", result) == 1)
	{
		param->gammaRevise = atoi(result);
		flag = 1;
	}

	if(xml_FindValue(XMLString, len, "xml/ImageParam/ImageDeal/Lighteness", result) == 1)
	{
		param->lighteness = atoi(result);
		flag = 1;
	}

	if(xml_FindValue(XMLString, len, "xml/ImageParam/ImageDeal/Acutance", result) == 1)
	{
		param->acutance = atoi(result);
		flag = 1;
	}

	if(xml_FindValue(XMLString, len, "xml/ImageParam/ImageDeal/Saturation", result) == 1)
	{
		param->saturation = atoi(result);
		flag = 1;
	}

	if(xml_FindValue(XMLString, len, "xml/ImageParam/ImageDeal/PushUpPerss", result) == 1)
	{
		param->pushUpPerss = atoi(result);
		flag = 1;
	}

	if(xml_FindValue(XMLString, len, "xml/ImageParam/ImageDeal/PushDownPerss", result) == 1)
	{
		param->pushDownPerss = atoi(result);
		flag = 1;
	}

	if(xml_FindValue(XMLString, len, "xml/ImageParam/ImageDeal/PushDownThre", result) == 1)
	{
		param->pushDownThre = atoi(result);
		flag = 1;
	}

	if(xml_FindValue(XMLString, len, "xml/ImageParam/ImageDeal/PushTimeThre", result) == 1)
	{
		param->pushTimeThre = atoi(result);
		flag = 1;
	}
	
	if(xml_FindValue(XMLString, len, "xml/ImageParam/ImageDeal/ImageQuality", result) == 1)
	{
		param->imageQuality = atoi(result);
		flag = 1;
	}

	if(xml_FindValue(XMLString, len, "xml/ImageParam/ImageDeal/ImageReversal", result) == 1)
	{
		param->imageReversal = atoi(result);
		flag = 1;
	}

	if(xml_FindValue(XMLString, len, "xml/ImageParam/Reserve1", result) == 1)
	{
		param->reserve1 = atoi(result);
		flag = 1;
	}

	if(xml_FindValue(XMLString, len, "xml/ImageParam/Reserve2", result) == 1)
	{
		param->reserve2 = atoi(result);
		flag = 1;
	}

	if(xml_FindValue(XMLString, len, "xml/ImageParam/Reserve3", result) == 1)
	{
		strcpy(param->reserve3, result);
		flag = 1;
	}

	if(xml_FindValue(XMLString, len, "xml/ImageParam/Reserve4", result) == 1)
	{
		strcpy(param->reserve4, result);
		flag = 1;
	}
	if(xml_FindValue(XMLString, len, "xml/ImageParam/HeadTailParam/PBTL_En", result) == 1)
	{
		param->PlateBackToLight_En = atoi(result);
		flag = 1;
	}

	if(xml_FindValue(XMLString, len, "xml/ImageParam/HeadTailParam/PBTL_Light", result) == 1)
	{
		param->PlateBackToLight_Light = atoi(result);
		flag = 1;
	}

	if(xml_FindValue(XMLString, len, "xml/ImageParam/HeadTailParam/PBTL_Begin", result) == 1)
	{
		param->PlateBackToLight_Begin = atoi(result);
		flag = 1;
	}

	if(xml_FindValue(XMLString, len, "xml/ImageParam/HeadTailParam/PBTL_End", result) == 1)
	{
		param->PlateBackToLight_End = atoi(result);
		flag = 1;
	}

	if(xml_FindValue(XMLString, len, "xml/ImageParam/HeadTailParam/PBTL_top", result) == 1)
	{
		param->PlateBackToLight_Rect.top = atoi(result);
		flag = 1;
	}

	if(xml_FindValue(XMLString, len, "xml/ImageParam/HeadTailParam/PBTL_bottom", result) == 1)
	{
		param->PlateBackToLight_Rect.bottom = atoi(result);
		flag = 1;
	}

	if(xml_FindValue(XMLString, len, "xml/ImageParam/HeadTailParam/PBTL_left", result) == 1)
	{
		param->PlateBackToLight_Rect.left = atoi(result);
		flag = 1;
	}

	if(xml_FindValue(XMLString, len, "xml/ImageParam/HeadTailParam/PBTL_right", result) == 1)
	{
		param->PlateBackToLight_Rect.right = atoi(result);
		flag = 1;
	}

	if(xml_FindValue(XMLString, len, "xml/ImageParam/HeadTailParam/PBTL_LightPercent", result) == 1)
	{
		param->PlateBackToLight_LightPercent = atoi(result);
		flag = 1;
	}

	//
	if(xml_FindValue(XMLString, len, "xml/ImageParam/HeadTailParam/PFTL_En", result) == 1)
	{
		param->PlateFaceToLight_En = atoi(result);
		flag = 1;
	}

	if(xml_FindValue(XMLString, len, "xml/ImageParam/HeadTailParam/PFTL_Light", result) == 1)
	{
		param->PlateFaceToLight_Light = atoi(result);
		flag = 1;
	}

	if(xml_FindValue(XMLString, len, "xml/ImageParam/HeadTailParam/PFTL_Begin", result) == 1)
	{
		param->PlateFaceToLight_Begin = atoi(result);
		flag = 1;
	}

	if(xml_FindValue(XMLString, len, "xml/ImageParam/HeadTailParam/PFTL_End", result) == 1)
	{
		param->PlateFaceToLight_End = atoi(result);
		flag = 1;
	}

	if(xml_FindValue(XMLString, len, "xml/ImageParam/HeadTailParam/PFTL_top", result) == 1)
	{
		param->PlateFaceToLight_Rect.top = atoi(result);
		flag = 1;
	}

	if(xml_FindValue(XMLString, len, "xml/ImageParam/HeadTailParam/PFTL_bottom", result) == 1)
	{
		param->PlateFaceToLight_Rect.bottom = atoi(result);
		flag = 1;
	}

	if(xml_FindValue(XMLString, len, "xml/ImageParam/HeadTailParam/PFTL_left", result) == 1)
	{
		param->PlateFaceToLight_Rect.left = atoi(result);
		flag = 1;
	}

	if(xml_FindValue(XMLString, len, "xml/ImageParam/HeadTailParam/PFTL_right", result) == 1)
	{
		param->PlateFaceToLight_Rect.right = atoi(result);
		flag = 1;
	}

	if(xml_FindValue(XMLString, len, "xml/ImageParam/HeadTailParam/PFTL_LightPercent", result) == 1)
	{
		param->PlateFaceToLight_LightPercent = atoi(result);
		flag = 1;
	}

	return flag;
}

//函数功能		从XML信息中解析出图像尾部信息
//XMLString		[in]XML信息
//len			[in]XML信息长度
//param			[out]图像尾部信息
//返回值：		成功返回1，失败返回0
int32	Xml_JieXiTailInofXml(const char *XMLString, const int32 len, STailInfo *param)
{
	char	result[NODEVALUE_MAX_LENGTH]={0};
	byte	flag = 0;
	
	if(xml_FindValue(XMLString, len, "xml/TailInfo/DevInfo", result) == 1)
	{
		strcpy(param->devInfo, result);
		flag = 1;
	}

	if(xml_FindValue(XMLString, len, "xml/TailInfo/DevIP", result) == 1)
	{
		strcpy(param->ip, result);
		flag = 1;
	}

	if(xml_FindValue(XMLString, len, "xml/TailInfo/CurState", result) == 1)
	{
		param->curState = atoi(result);
		flag = 1;
	}
	
	if(xml_FindValue(XMLString, len, "xml/TailInfo/CapTime", result) == 1)
	{
		strcpy(param->capTime, result);
		flag = 1;
	}

	if(xml_FindValue(XMLString, len, "xml/TailInfo/PlateStr", result) == 1)
	{
		strcpy(param->plateStr, result);
		flag = 1;
	}

	if(xml_FindValue(XMLString, len, "xml/TailInfo/PlateColor", result) == 1)
	{
		strcpy(param->plateColor, result);
		flag = 1;
	}

	if(xml_FindValue(XMLString, len, "xml/TailInfo/RecWeight", result) == 1)
	{
		param->recWeight = atoi(result);
		flag = 1;
	}

	if(xml_FindValue(XMLString, len, "xml/TailInfo/PlateRect/Top", result) == 1)
	{
		param->plateRect.top = atoi(result);
		flag = 1;
	}

	if(xml_FindValue(XMLString, len, "xml/TailInfo/PlateRect/Bottom", result) == 1)
	{
		param->plateRect.bottom = atoi(result);
		flag = 1;
	}

	if(xml_FindValue(XMLString, len, "xml/TailInfo/PlateRect/Left", result) == 1)
	{
		param->plateRect.left = atoi(result);
		flag = 1;
	}

	if(xml_FindValue(XMLString, len, "xml/TailInfo/PlateRect/Right", result) == 1)
	{
		param->plateRect.right = atoi(result);
		flag = 1;
	}

	if(xml_FindValue(XMLString, len, "xml/TailInfo/CarDirection", result) == 1)
	{
		param->carDirection = atoi(result);
		flag = 1;
	}
	
	if(xml_FindValue(XMLString, len, "xml/TailInfo/MatchFlag", result) == 1)
	{
		param->matchFlag = atoi(result);
		flag = 1;
	}

	if(xml_FindValue(XMLString, len, "xml/TailInfo/CapManner", result) == 1)
	{
		param->capManner = atoi(result);
		flag = 1;
	}

	return flag;
}


//函数功能		从XML信息中解析出TFTP尾部信息
//XMLString		[in]XML信息
//len			[in]XML信息长度
//param			[out]TFTP尾部信息
//返回值：		成功返回1，失败返回0
int32	Xml_JieXiTFTPTailInofXml(const char *XMLString, const int32 len, STFTPTailInfo *param)
{
	char	result[NODEVALUE_MAX_LENGTH]={0};
	byte	flag = 0;

	if(xml_FindValue(XMLString, len, "xml/HaveImage/BigImage", result) == 1)
	{
		param->bigImage = atoi(result);
		flag = 1;
	}

	if(xml_FindValue(XMLString, len, "xml/HaveImage/SmallImage", result) == 1)
	{
		param->smallImage = atoi(result);
		flag = 1;
	}

	if(xml_FindValue(XMLString, len, "xml/HaveImage/BinImage", result) == 1)
	{
		param->binImage = atoi(result);
		flag = 1;
	}
	

	return flag;
}

//函数功能		从XML信息中解析出相机状态信息
//XMLString		[in]XML信息
//len			[in]XML信息长度
//param			[out]相机状态信息
//返回值：		成功返回1，失败返回0
int32	Xml_JieCammerStateXml(const char *XMLString, const int32 len, SCammerState *param)
{
	char	result[NODEVALUE_MAX_LENGTH]={0};
	byte	flag = 0;

	if(xml_FindValue(XMLString, len, "xml/CammerState/BpParam", result) == 1)
	{
		param->BpParam = atoi(result);
		flag = 1;
	}

	if(xml_FindValue(XMLString, len, "xml/CammerState/ColorParam", result) == 1)
	{
		param->colorParam = atoi(result);
		flag = 1;
	}

	if(xml_FindValue(XMLString, len, "xml/CammerState/PlateList", result) == 1)
	{
		param->plateList = atoi(result);
		flag = 1;
	}

	if(xml_FindValue(XMLString, len, "xml/CammerState/CammerHead", result) == 1)
	{
		param->cammerHead = atoi(result);
		flag = 1;
	}

	if(xml_FindValue(XMLString, len, "xml/CammerState/Clock", result) == 1)
	{
		param->clock = atoi(result);
		flag = 1;
	}

	if(xml_FindValue(XMLString, len, "xml/CammerState/SDCard", result) == 1)
	{
		param->SDCard = atoi(result);
		flag = 1;
	}

	if(xml_FindValue(XMLString, len, "xml/CammerState/SPIFLASH", result) == 1)
	{
		param->SPIFLASH = atoi(result);
		flag = 1;
	}

	if(xml_FindValue(XMLString, len, "xml/CammerState/MemoryChip", result) == 1)
	{
		param->memoryChip = atoi(result);
		flag = 1;
	}

	//解析识别库版本
	if(xml_FindValue(XMLString, len, "xml/CammerState/cCarLibVer", result) == 1)
	{
		strncpy(param->cCarLibVer,result,20);
		flag = 1;
	}
	//解析BP参数版本
	if(xml_FindValue(XMLString, len, "xml/CammerState/cBpParamVer", result) == 1)
	{
		strncpy(param->cBpParamVer,result,20);
		flag = 1;
	}
	//解析颜色表版本
	if(xml_FindValue(XMLString, len, "xml/CammerState/cRecColorVer", result) == 1)
	{
		strncpy(param->cRecColorVer,result,20);
		flag = 1;
	}
	

	return flag;
}

//函数功能		从XML中取出当前图片信息
//XMLString		[in]XML信息
//len			[in]XML信息长度
//param			[out]TFTP尾部信息
//返回值：		成功返回1，失败返回0
int Xml_JieXiGetCurPicXML(const char *XMLString, const int32 xmlLen, SCurPicParam *param)
{

	char	xmlResult[NODEVALUE_MAX_LENGTH]={0};
	byte	flag = 0;

	if(xml_FindValue(XMLString, xmlLen, "xml/CurPicParam/curGainNo", xmlResult) == 1)
	{
		param->curGainNo = atoi(xmlResult);
		flag = 1;
	}

	if(xml_FindValue(XMLString, xmlLen, "xml/CurPicParam/curGlobleCapLight", xmlResult) == 1)
	{
		param->curGlobleCapLight = atoi(xmlResult);
		flag = 1;
	}

	if(xml_FindValue(XMLString, xmlLen, "xml/CurPicParam/curGlobleLightPrecent", xmlResult) == 1)
	{
		param->curGlobleLightPrecent = atoi(xmlResult);
		flag = 1;
	}

	if(xml_FindValue(XMLString, xmlLen, "xml/CurPicParam/curRefLight", xmlResult) == 1)
	{
		param->curRefLight = atoi(xmlResult);
		flag = 1;
	}

	if(xml_FindValue(XMLString, xmlLen, "xml/CurPicParam/curCalcLight", xmlResult) == 1)
	{
		param->curCalcLight = atoi(xmlResult);
		flag = 1;
	}

	if(xml_FindValue(XMLString, xmlLen, "xml/CurPicParam/curZoneCapLight", xmlResult) == 1)
	{
		param->curZoneCapLight = atoi(xmlResult);
		flag = 1;
	}

	if(xml_FindValue(XMLString, xmlLen, "xml/CurPicParam/curZoneLightPrecent", xmlResult) == 1)
	{
		param->curZoneLightPrecent = atoi(xmlResult);
		flag = 1;
	}

	if(xml_FindValue(XMLString, xmlLen, "xml/CurPicParam/shutter", xmlResult) == 1)
	{
		param->shutter = atoi(xmlResult);
		flag = 1;
	}

	if(xml_FindValue(XMLString, xmlLen, "xml/CurPicParam/adj_type", xmlResult) == 1)
	{
		param->adj_type = atoi(xmlResult);
		flag = 1;
	}

	return flag;
}

//函数功能		从XML信息中解析出叠加参数
//XMLString		[in]XML信息
//len			[in]XML信息长度
//param			[out]信息叠加参数参数
//返回值：		成功返回1，失败返回0
int32	Xml_JieXiOverParamXml(const char *XMLString, const int32 len, s_dynamic_over_info *param)
{
	char	result[NODEVALUE_MAX_LENGTH]={0};
	byte	flag = 0;
	int    index = 0;
	char    xmlName[NODEVALUE_MAX_LENGTH] = {0};

	param->iBanisterFlag = 0;
	if(xml_FindValue(XMLString, len, "xml/OverInfo/BanisterFlag", result) == 1)
	{
		param->iBanisterFlag = atoi(result);
		if(param->iBanisterFlag != 0)//当是栏杆状态下发时，不处理其它动态信息解析
			return 1;
	}

	if(xml_FindValue(XMLString, len, "xml/OverInfo/MessNum", result) == 1)
	{
		param->m_iDynamicOverMessNum = atoi(result);
		flag = 1;
	}

	if(param->m_iDynamicOverMessNum > MAX_OVERMESSNUM || param->m_iDynamicOverMessNum < 1)
		return 0;

	if(xml_FindValue(XMLString, len, "xml/OverInfo/Stand", result) == 1)
	{
		param->m_iDynamicOverStand = atoi(result);
		flag = 1;
	}

	for(index = 0; index < param->m_iDynamicOverMessNum; index++)
	{

		memset(xmlName, 0, sizeof(xmlName));
		sprintf(xmlName, "xml/OverInfo/OverMess%d/LeftDis", index + 1);
		if(xml_FindValue(XMLString, len, xmlName, result) == 1)
		{
			param->m_pOver_mess[index].iLeftDis = atoi(result);
			flag = 1;
		}

		memset(xmlName, 0, sizeof(xmlName));
		sprintf(xmlName, "xml/OverInfo/OverMess%d/TopDis", index + 1);
		if(xml_FindValue(XMLString, len, xmlName, result) == 1)
		{
			param->m_pOver_mess[index].iTopDis = atoi(result);
			flag = 1;
		}

		memset(xmlName, 0, sizeof(xmlName));
		sprintf(xmlName, "xml/OverInfo/OverMess%d/Font", index + 1);
		if(xml_FindValue(XMLString, len, xmlName, result) == 1)
		{
			param->m_pOver_mess[index].iFont = atoi(result);
			flag = 1;
		}

		memset(xmlName, 0, sizeof(xmlName));
		sprintf(xmlName, "xml/OverInfo/OverMess%d/FontSize", index + 1);
		if(xml_FindValue(XMLString, len, xmlName, result) == 1)
		{
			param->m_pOver_mess[index].iFontSize = atoi(result);
			flag = 1;
		}

		memset(xmlName, 0, sizeof(xmlName));
		sprintf(xmlName, "xml/OverInfo/OverMess%d/EdgeColor", index + 1);
		if(xml_FindValue(XMLString, len, xmlName, result) == 1)
		{
			param->m_pOver_mess[index].iEdgeColor = atoi(result);
			flag = 1;
		}

		memset(xmlName, 0, sizeof(xmlName));
		sprintf(xmlName, "xml/OverInfo/OverMess%d/CharColor", index + 1);
		if(xml_FindValue(XMLString, len, xmlName, result) == 1)
		{
			param->m_pOver_mess[index].iCharColor = atoi(result);
			flag = 1;
		}

		memset(xmlName, 0, sizeof(xmlName));
		sprintf(xmlName, "xml/OverInfo/OverMess%d/BackColor", index + 1);
		if(xml_FindValue(XMLString, len, xmlName, result) == 1)
		{
			param->m_pOver_mess[index].iBackColor = atoi(result);
			flag = 1;
		}

		memset(xmlName, 0, sizeof(xmlName));
		sprintf(xmlName, "xml/OverInfo/OverMess%d/Space", index + 1);
		if(xml_FindValue(XMLString, len, xmlName, result) == 1)
		{
			param->m_pOver_mess[index].iSpace = atoi(result);
			flag = 1;
		}

		memset(xmlName, 0, sizeof(xmlName));
		sprintf(xmlName, "xml/OverInfo/OverMess%d/Text", index + 1);
		if(xml_FindValue(XMLString, len, xmlName, result) == 1)
		{
			memset(param->m_pOver_mess[index].szText, 0, MAX_OVERCHARNUM);
			strcpy(param->m_pOver_mess[index].szText, result);
			flag = 1;
		}
	}

	if(xml_FindValue(XMLString, len, "xml/AlertInfo/AlertFlag", result) == 1)
	{
		param->m_AlertInfo.iAlertFlag = atoi(result);
		flag = 1;
	}

	if(xml_FindValue(XMLString, len, "xml/AlertInfo/AlertTime", result) == 1)
	{
		param->m_AlertInfo.iAlertTime = atoi(result);
		flag = 1;
	}

	return flag;
}

//函数功能		从XML信息中解析出叠加参数
//XMLString		[in]XML信息
//len			[in]XML信息长度
//param			[out]信息叠加参数参数
//返回值：		成功返回1，失败返回0
int32	Xml_JieXiVideoOverTimeParamXml(const char *XMLString, const int32 len, s_dynamic_VideoOverInfo *param)
{
	char	result[NODEVALUE_MAX_LENGTH]={0};
	byte	flag = 0;


	if(xml_FindValue(XMLString, len, "xml/VideoOverInfo/VideoOverFlag", result) == 1)
	{
		param->VideoOverFlag = atoi(result);
		flag = 1;
	}

	return flag;
}

//函数功能		从XML信息中解析出调试信息参数
//XMLString		[in]XML信息
//len			[in]XML信息长度
//param			[out]相机状态信息
//返回值：		成功返回1，失败返回0
int32	Xml_JieXiDebugParamXml(const char *XMLString, const int32 len, SUDPDebug *param)
{
	char	result[NODEVALUE_MAX_LENGTH]={0};
	byte	flag = 0;

	if(xml_FindValue(XMLString, len, "xml/DebugParam/UDPUpIP", result) == 1)
	{
		memset(param->UDPUpIP, 0, MAX_IP);
		strcpy(param->UDPUpIP, result);
		flag = 1;
	}

	if(xml_FindValue(XMLString, len, "xml/DebugParam/UDPUpPort", result) == 1)
	{
		param->UDPUpPort = atoi(result);
		flag = 1;
	}

	if(xml_FindValue(XMLString, len, "xml/DebugParam/DebugFlag", result) == 1)
	{
		param->DebugFlag = atoi(result);
		flag = 1;
	}

	if(xml_FindValue(XMLString, len, "xml/DebugParam/RecDebugFlag", result) == 1)
	{
		param->RecDebugFlag = atoi(result);
		flag = 1;
	}

	return flag;
}

//函数功能		从XML信息中解析出侧装卡口参数
//XMLString		[in]XML信息
//len			[in]XML信息长度
//param			[out]相机状态信息
//返回值：		成功返回1，失败返回0
int32	Xml_JieXiSideParamXml(const char *XMLString, const int32 len, s_side_param *param)
{
	char	result[NODEVALUE_MAX_LENGTH]={0};
	byte	flag = 0;

	if(xml_FindValue(XMLString, len, "xml/SideParam/saveFlag", result) == 1)
	{
		param->saveFlag = atoi(result);
		flag = 1;
	}

	if(xml_FindValue(XMLString, len, "xml/SideParam/beginRoad", result) == 1)
	{
		param->beginRoad = atoi(result);
		flag = 1;
	}

	if(xml_FindValue(XMLString, len, "xml/SideParam/runHeading", result) == 1)
	{
		param->runHeading = atoi(result);
		flag = 1;
	}

	if(xml_FindValue(XMLString, len, "xml/SideParam/saveSpace", result) == 1)
	{
		param->saveSpace = atoi(result);
		flag = 1;
	}

	return flag;
}

#ifdef WIN32

int HexToString(char * in, char * out)
{
	int i;
	for(i = 0; i < strlen(in)/2; i ++)
 	{
		out[i] = 0;
		if((in[i * 2] >= '0') && (in[i * 2] <= '9'))
			out[i] = (in[i * 2] - '0') * 16;
		else
			out[i] = ((in[i * 2] - 'a') + 10) * 16;
		if((in[i * 2 + 1] >= '0') && (in[i * 2 + 1] <= '9'))
			out[i] = out[i] + (in[i * 2 + 1] - '0') ;
		else
			out[i]  = out[i] + (in[i * 2 + 1] - 'a') + 10;
	}

	out[i] = 0;
	return 0;
}

//函数功能		从XML信息中解析出IP配置参数
//XMLString		[in]XML信息
//len			[in]XML信息长度
//param			[out]网络参数
//返回值：		成功返回1，失败返回0
int32	Xml_JieXiCamParam_Net(const char *XMLString, int32 len, s_Net_Param *param)
{
	char	result[NODEVALUE_MAX_LENGTH]={0};
	byte	flag = 0;

	if(xml_FindValue(XMLString, len, "net/ip1", result) == 1)
	{
		strcpy(param->ip, result);
		flag = 1;
	}

	if(xml_FindValue(XMLString, len, "net/mask1", result) == 1)
	{
		strcpy(param->mask, result);
		flag = 1;
	}

	if(xml_FindValue(XMLString, len, "net/gate1", result) == 1)
	{
		strcpy(param->gate, result);
		flag = 1;
	}

	return flag;
}

//函数功能		从XML信息中解析出压缩参数
//XMLString		[in]XML信息
//len			[in]XML信息长度
//param			[out]网络参数
//返回值：		成功返回1，失败返回0
int32	Xml_JieXiCamParam_Enc(const char *XMLString, int32 len, s_Enc_Param *param)
{
	char	result[NODEVALUE_MAX_LENGTH]={0};
	byte	flag = 0;

	if(xml_FindValue(XMLString, len, "enc/rate", result) == 1)
	{
		param->irate = atoi(result);
		flag = 1;
	}

	if(xml_FindValue(XMLString, len, "enc/h264enctype", result) == 1)
	{
		param->ih264enctype = atoi(result);
		flag = 1;
	}

	return flag;
}

//函数功能		从XML信息中解析出 NTP对时 参数
//XMLString		[in]XML信息
//len			[in]XML信息长度
//param			[out]网络参数
//返回值：		成功返回1，失败返回0
int32	Xml_JieXiCamParam_Ntp(const char *XMLString, int32 len, s_Ntp_Param *param)
{
	char	result[NODEVALUE_MAX_LENGTH]={0};
	byte	flag = 0;

	if(xml_FindValue(XMLString, len, "ntp/svr_ip", result) == 1)
	{
		strcpy(param->svr_ip, result);
		flag = 1;
	}

	if(xml_FindValue(XMLString, len, "ntp/interval", result) == 1)
	{
		param->interval = atoi(result);
		flag = 1;
	}

	return flag;
}

//函数功能		从XML信息中解析出 叠加 参数
//XMLString		[in]XML信息
//len			[in]XML信息长度
//param			[out]网络参数
//返回值：		成功返回1，失败返回0
int32	Xml_JieXiCamParam_Blend(const char *XMLString, int32 len, s_blend_mess *param)
{
	char	result[NODEVALUE_MAX_LENGTH]={0}, tmp[NODEVALUE_MAX_LENGTH] = {0};
	byte	flag = 0;

	if(xml_FindValue(XMLString, len, "blend/time", result) == 1)
	{
		param->time = atoi(result);
		flag = 1;
	}

	if(xml_FindValue(XMLString, len, "blend/size", result) == 1)
	{
		param->iSize = atoi(result);
		flag = 1;
	}

	if(xml_FindValue(XMLString, len, "blend/tleft", result) == 1)
	{
		param->iTLeft = atoi(result);
		flag = 1;
	}

	if(xml_FindValue(XMLString, len, "blend/ttop", result) == 1)
	{
		param->iTTop = atoi(result);
		flag = 1;
	}

	if(xml_FindValue(XMLString, len, "blend/str1", result) == 1)
	{
		HexToString(result, tmp);
		strcpy(param->strMess[0].string, tmp);
		flag = 1;
	}

	if(xml_FindValue(XMLString, len, "blend/str1left", result) == 1)
	{
		param->strMess[0].iLeft = atoi(result);
		flag = 1;
	}

	if(xml_FindValue(XMLString, len, "blend/str1top", result) == 1)
	{
		param->strMess[0].iTop = atoi(result);
		flag = 1;
	}

	if(xml_FindValue(XMLString, len, "blend/str2", result) == 1)
	{
		HexToString(result, tmp);
		strcpy(param->strMess[1].string, tmp);
		flag = 1;
	}

	if(xml_FindValue(XMLString, len, "blend/str2left", result) == 1)
	{
		param->strMess[1].iLeft = atoi(result);
		flag = 1;
	}

	if(xml_FindValue(XMLString, len, "blend/str2top", result) == 1)
	{
		param->strMess[1].iTop = atoi(result);
		flag = 1;
	}

	return flag;
}

//函数功能		从XML信息中解析出 相机标识 参数
//XMLString		[in]XML信息
//len			[in]XML信息长度
//param			[out]网络参数
//返回值：		成功返回1，失败返回0
int32	Xml_JieXiCamParam_Cames(const char *XMLString, int32 len, s_Cames_Param *param)
{
	char	result[NODEVALUE_MAX_LENGTH]={0}, tmp[NODEVALUE_MAX_LENGTH]={0};
	byte	flag = 0;

	if(xml_FindValue(XMLString, len, "cames/camer_id", result) == 1)
	{
		strcpy(param->camer_id, result);
		flag = 1;
	}

	if(xml_FindValue(XMLString, len, "cames/camermes", result) == 1)
	{
		HexToString(result, tmp);
		strcpy(param->camermes, result);
		flag = 1;
	}

	return flag;
}

//函数功能		从XML信息中解析出 FPGA节点 参数
//XMLString		[in]XML信息
//len			[in]XML信息长度
//param			[out]网络参数
//返回值：		成功返回1，失败返回0
int32	Xml_JieXiCamParam_FPGA(const char *XMLString, int32 len, s_FPGA_Param *param)
{
	char	result[NODEVALUE_MAX_LENGTH]={0}, tmp[NODEVALUE_MAX_LENGTH]={0};
	byte	flag = 0;

	if(xml_FindValue(XMLString, len, "fpga/jpegquval", result) == 1)
	{
		param->jpegquval = atoi(result);
		flag = 1;
	}

	if(xml_FindValue(XMLString, len, "fpga/feathmode", result) == 1)
	{
		param->feathmode = atoi(result);
		flag = 1;
	}

	if(xml_FindValue(XMLString, len, "fpga/ws", result) == 1)
	{
		param->ws = atoi(result);
		flag = 1;
	}

	if(xml_FindValue(XMLString, len, "fpga/alt", result) == 1)
	{
		param->alt = atoi(result);
		flag = 1;
	}



	return flag;
}

//函数功能		从XML信息中解析出 image 节点参数
//XMLString		[in]XML信息
//len			[in]XML信息长度
//param			[out]网络参数
//返回值：		成功返回1，失败返回0
int32	Xml_JieXiCamParam_ImageParam(const char *XMLString, int32 len, s_ImageParam_Param *param)
{
	char	result[NODEVALUE_MAX_LENGTH]={0}, tmp[NODEVALUE_MAX_LENGTH]={0};
	byte	flag = 0, i = 0;

	if(xml_FindValue(XMLString, len, "image/imgmode", result) == 1)
	{
		param->imageMode[0] = atoi(result);
		flag = 1;
	}

	for(i = 0; i < 4; i++)
	{
		sprintf(tmp, "image/sharp%d", i+1);

		if(xml_FindValue(XMLString, len, tmp, result) == 1)
		{
			param->Sharp[i] = atoi(result);
			flag = 1;
		}

		sprintf(tmp, "image/smooth%d", i+1);

		if(xml_FindValue(XMLString, len, tmp, result) == 1)
		{
			param->Smooth[i] = atoi(result);
			flag = 1;
		}

		sprintf(tmp, "image/smoothex%d", i+1);

		if(xml_FindValue(XMLString, len, tmp, result) == 1)
		{
			param->Smoothex[i] = atoi(result);
			flag = 1;
		}

		sprintf(tmp, "image/satur%d", i+1);

		if(xml_FindValue(XMLString, len, tmp, result) == 1)
		{
			param->Saturate[i] = atoi(result);
			flag = 1;
		}

		sprintf(tmp, "image/fact%d", i+1);

		if(xml_FindValue(XMLString, len, tmp, result) == 1)
		{
			param->MaxSFactor[i] = atoi(result);
			flag = 1;
		}

		sprintf(tmp, "image/sbase%d", i+1);

		if(xml_FindValue(XMLString, len, tmp, result) == 1)
		{
			param->MaxSBase[i] = atoi(result);
			flag = 1;
		}

		sprintf(tmp, "image/lsup%d", i+1);

		if(xml_FindValue(XMLString, len, tmp, result) == 1)
		{
			param->UpLimit[i] = atoi(result);
			flag = 1;
		}

		sprintf(tmp, "image/lsdown%d", i+1);

		if(xml_FindValue(XMLString, len, tmp, result) == 1)
		{
			param->DownLimit[i] = atoi(result);
			flag = 1;
		}

		sprintf(tmp, "image/fpgaexp%d", i+1);

		if(xml_FindValue(XMLString, len, tmp, result) == 1)
		{
			param->MaxExpo[i] = atoi(result);
			flag = 1;
		}

		sprintf(tmp, "image/fpgaMin%d", i+1);

		if(xml_FindValue(XMLString, len, tmp, result) == 1)
		{
			param->MinExpo[i] = atoi(result);
			flag = 1;
		}

		sprintf(tmp, "image/fpgaplu%d", i+1);

		if(xml_FindValue(XMLString, len, tmp, result) == 1)
		{
			param->MaxPlusNum[i] = atoi(result);
			flag = 1;
		}

		sprintf(tmp, "image/fpgadig%d", i+1);

		if(xml_FindValue(XMLString, len, tmp, result) == 1)
		{
			param->MaxDigitalNum[i] = atoi(result);
			flag = 1;
		}
	}

	if(xml_FindValue(XMLString, len, "image/cycleoff", result) == 1)
	{
		param->syncOffset[0] = atoi(result);
		flag = 1;
	}



	return flag;
}

//函数功能		从XML信息中解析出 wan 节点参数
//XMLString		[in]XML信息
//len			[in]XML信息长度
//param			[out]网络参数
//返回值：		成功返回1，失败返回0
int32	Xml_JieXiCamParam_Wan(const char *XMLString, int32 len, s_Trans_Param *param)
{
	char	result[NODEVALUE_MAX_LENGTH]={0}, tmp[NODEVALUE_MAX_LENGTH]={0};
	byte	flag = 0, i = 0;

	if(xml_FindValue(XMLString, len, "wan/wanEn", result) == 1)
	{
		param->dataEnable = atoi(result);
		flag = 1;
	}

	if(xml_FindValue(XMLString, len, "wan/wanTftpEn", result) == 1)
	{
		param->tftpEnable = atoi(result);
		flag = 1;
	}

	if(xml_FindValue(XMLString, len, "wan/wanDomain", result) == 1)
	{
		strcpy(param->udpDomain, result);
		flag = 1;
	}

	if(xml_FindValue(XMLString, len, "wan/wanPort", result) == 1)
	{
		param->udpPort = atoi(result);
		flag = 1;
	}

	if(xml_FindValue(XMLString, len, "wan/wanTftpCon", result) == 1)
	{
		param->tftpControl = atoi(result);
		flag = 1;
	}

	if(xml_FindValue(XMLString, len, "wan/wanFtpEn", result) == 1)
	{
		param->ftpEnable = atoi(result);
		flag = 1;
	}

	if(xml_FindValue(XMLString, len, "wan/wanDomain1", result) == 1)
	{
		strcpy(param->ftpDomain, result);
		flag = 1;
	}

	if(xml_FindValue(XMLString, len, "wan/wanftpName", result) == 1)
	{
		strcpy(param->ftpUser, result);
		flag = 1;
	}

	if(xml_FindValue(XMLString, len, "wan/wanftpPass", result) == 1)
	{
		strcpy(param->ftpPass, result);
		flag = 1;
	}

	if(xml_FindValue(XMLString, len, "wan/wanFtpCon", result) == 1)
	{
		param->ftpControl = atoi(result);
		flag = 1;
	}

	return flag;
}

//函数功能		从XML信息中解析出 Lan 节点参数
//XMLString		[in]XML信息
//len			[in]XML信息长度
//param			[out]网络参数
//返回值：		成功返回1，失败返回0
int32	Xml_JieXiCamParam_Lan(const char *XMLString, int32 len, s_Trans_Param *param)
{
	char	result[NODEVALUE_MAX_LENGTH]={0}, tmp[NODEVALUE_MAX_LENGTH]={0};
	byte	flag = 0, i = 0;

	if(xml_FindValue(XMLString, len, "lan/lanEn", result) == 1)
	{
		param->dataEnable = atoi(result);
		flag = 1;
	}

	if(xml_FindValue(XMLString, len, "lan/lanTftpEn", result) == 1)
	{
		param->tftpEnable = atoi(result);
		flag = 1;
	}

	if(xml_FindValue(XMLString, len, "lan/lanTftpIP", result) == 1)
	{
		strcpy(param->udpDomain, result);
		flag = 1;
	}

	if(xml_FindValue(XMLString, len, "lan/lanPort", result) == 1)
	{
		param->udpPort = atoi(result);
		flag = 1;
	}

	if(xml_FindValue(XMLString, len, "lan/lanOver", result) == 1)
	{
		param->overTime = atoi(result);
		flag = 1;
	}

	if(xml_FindValue(XMLString, len, "lan/lanTftpCon", result) == 1)
	{
		param->tftpControl = atoi(result);
		flag = 1;
	}

	if(xml_FindValue(XMLString, len, "lan/lanFtpEn", result) == 1)
	{
		param->ftpEnable = atoi(result);
		flag = 1;
	}

	if(xml_FindValue(XMLString, len, "lan/lanFtpIp", result) == 1)
	{
		strcpy(param->ftpDomain, result);
		flag = 1;
	}

	if(xml_FindValue(XMLString, len, "lan/lanFtpUser", result) == 1)
	{
		strcpy(param->ftpUser, result);
		flag = 1;
	}

	if(xml_FindValue(XMLString, len, "lan/lanFtpPass", result) == 1)
	{
		strcpy(param->ftpPass, result);
		flag = 1;
	}

	if(xml_FindValue(XMLString, len, "lan/lanFtpCon", result) == 1)
	{
		param->ftpControl = atoi(result);
		flag = 1;
	}

	if(xml_FindValue(XMLString, len, "lan/udpcon1", result) == 1)
	{
		param->udpcon1 = atoi(result);
		flag = 1;
	}

	if(xml_FindValue(XMLString, len, "lan/udpip1", result) == 1)
	{
		strcpy(param->udpip1, result);
		flag = 1;
	}

	if(xml_FindValue(XMLString, len, "lan/udpport1", result) == 1)
	{
		param->udpport1 = atoi(result);
		flag = 1;
	}

	if(xml_FindValue(XMLString, len, "lan/udpcon2", result) == 1)
	{
		param->udpcon2 = atoi(result);
		flag = 1;
	}

	if(xml_FindValue(XMLString, len, "lan/udpip2", result) == 1)
	{
		strcpy(param->udpip2, result);
		flag = 1;
	}

	if(xml_FindValue(XMLString, len, "lan/udpport2", result) == 1)
	{
		param->udpport2 = atoi(result);
		flag = 1;
	}

	return flag;
}

//函数功能		从XML信息中解析出 mat1,mat2,mat3 节点参数
//XMLString		[in]XML信息
//len			[in]XML信息长度
//param			[out]网络参数
//返回值：		成功返回1，失败返回0
int32	Xml_JieXiCamParam_Max(const char *XMLString, int32 len, s_Mat_Param *param)
{
	char	result[NODEVALUE_MAX_LENGTH]={0}, tmp[NODEVALUE_MAX_LENGTH]={0};
	byte	flag = 0, i = 0, j = 0;

	for(i = 0; i < 3; i++)
	{
		for(j = 0; j < 4; j++)
		{
			sprintf(tmp, "mat1/A1%d%d", i+1, j+1);
			if(xml_FindValue(XMLString, len, tmp, result) == 1)
			{
				param->m_Mat1[i*4 + j] = atoi(result);
				flag = 1;
			}
		}
	}

	for(i = 0; i < 3; i++)
	{
		for(j = 0; j < 4; j++)
		{
			sprintf(tmp, "mat2/A2%d%d", i+1, j+1);
			if(xml_FindValue(XMLString, len, tmp, result) == 1)
			{
				param->m_Mat2[i*4 + j] = atoi(result);
				flag = 1;
			}
		}
	}

	for(i = 0; i < 3; i++)
	{
		for(j = 0; j < 4; j++)
		{
			sprintf(tmp, "mat3/A3%d%d", i+1, j+1);
			if(xml_FindValue(XMLString, len, tmp, result) == 1)
			{
				param->m_Mat3[i*4 + j] = atoi(result);
				flag = 1;
			}
		}
	}


	return flag;
}

//函数功能		从XML信息中解析出 rslt 节点参数
//XMLString		[in]XML信息
//len			[in]XML信息长度
//param			[out]网络参数
//返回值：		成功返回1，失败返回0
int32	Xml_JieXiCamParam_rslt(const char *XMLString, int32 len, s_rslt_Param *param)
{
	char	result[NODEVALUE_MAX_LENGTH]={0}, tmp[NODEVALUE_MAX_LENGTH]={0};
	byte	flag = 0;

	if(xml_FindValue(XMLString, len, "rslt/id", result) == 1)
	{
		param->id = atoi(result);
		flag = 1;
	}


	return flag;
}

//函数功能		从XML信息中解析出 fbtl 节点参数
//XMLString		[in]XML信息
//len			[in]XML信息长度
//param			[out]网络参数
//返回值：		成功返回1，失败返回0
int32	Xml_JieXiCamParam_fbtl(const char *XMLString, int32 len, s_fbtl_Param *param)
{
	char	result[NODEVALUE_MAX_LENGTH]={0}, tmp[NODEVALUE_MAX_LENGTH]={0};
	byte	flag = 0;

	if(xml_FindValue(XMLString, len, "fbtl/btl_en", result) == 1)
	{
		param->PlateBackToLight_En = atoi(result);
		flag = 1;
	}

	if(xml_FindValue(XMLString, len, "fbtl/btl_lt", result) == 1)
	{
		param->PlateBackToLight_Light = atoi(result);
		flag = 1;
	}

	if(xml_FindValue(XMLString, len, "fbtl/btl_bg", result) == 1)
	{
		param->PlateBackToLight_Begin = atoi(result);
		flag = 1;
	}

	if(xml_FindValue(XMLString, len, "fbtl/btl_ed", result) == 1)
	{
		param->PlateBackToLight_End = atoi(result);
		flag = 1;
	}

	if(xml_FindValue(XMLString, len, "fbtl/btl_rt", result) == 1)
	{
		param->PlateBackToLight_Rect.top = atoi(result);
		flag = 1;
	}

	if(xml_FindValue(XMLString, len, "fbtl/btl_rb", result) == 1)
	{
		param->PlateBackToLight_Rect.bottom = atoi(result);
		flag = 1;
	}

	if(xml_FindValue(XMLString, len, "fbtl/btl_rl", result) == 1)
	{
		param->PlateBackToLight_Rect.left = atoi(result);
		flag = 1;
	}

	if(xml_FindValue(XMLString, len, "fbtl/btl_rR", result) == 1)
	{
		param->PlateBackToLight_Rect.right = atoi(result);
		flag = 1;
	}

	if(xml_FindValue(XMLString, len, "fbtl/btl_lp", result) == 1)
	{
		param->PlateBackToLight_LightPercent = atoi(result);
		flag = 1;
	}
	//////////////////////////////////////////////////////////

	if(xml_FindValue(XMLString, len, "fbtl/ftl_en", result) == 1)
	{
		param->PlateFaceToLight_En = atoi(result);
		flag = 1;
	}

	if(xml_FindValue(XMLString, len, "fbtl/ftl_lt", result) == 1)
	{
		param->PlateFaceToLight_Light = atoi(result);
		flag = 1;
	}

	if(xml_FindValue(XMLString, len, "fbtl/ftl_bg", result) == 1)
	{
		param->PlateFaceToLight_Begin = atoi(result);
		flag = 1;
	}

	if(xml_FindValue(XMLString, len, "fbtl/ftl_ed", result) == 1)
	{
		param->PlateFaceToLight_End = atoi(result);
		flag = 1;
	}

	if(xml_FindValue(XMLString, len, "fbtl/ftl_rt", result) == 1)
	{
		param->PlateFaceToLight_Rect.top = atoi(result);
		flag = 1;
	}

	if(xml_FindValue(XMLString, len, "fbtl/ftl_rb", result) == 1)
	{
		param->PlateFaceToLight_Rect.bottom = atoi(result);
		flag = 1;
	}

	if(xml_FindValue(XMLString, len, "fbtl/ftl_rl", result) == 1)
	{
		param->PlateFaceToLight_Rect.left = atoi(result);
		flag = 1;
	}

	if(xml_FindValue(XMLString, len, "fbtl/ftl_rR", result) == 1)
	{
		param->PlateFaceToLight_Rect.right = atoi(result);
		flag = 1;
	}

	if(xml_FindValue(XMLString, len, "fbtl/ftl_lp", result) == 1)
	{
		param->PlateFaceToLight_LightPercent = atoi(result);
		flag = 1;
	}


	return flag;
}

//函数功能		从XML信息中解析出 imex 节点参数
//XMLString		[in]XML信息
//len			[in]XML信息长度
//param			[out]网络参数
//返回值：		成功返回1，失败返回0
int32	Xml_JieXiCamParam_imex(const char *XMLString, int32 len, s_imex_Param *param)
{
	char	result[NODEVALUE_MAX_LENGTH]={0}, tmp[NODEVALUE_MAX_LENGTH]={0};
	byte	flag = 0;

	if(xml_FindValue(XMLString, len, "imex/smwe", result) == 1)
	{
		memset(param->smwe, 0, sizeof(param->smwe));
		strcpy(param->smwe, result);
		flag = 1;
	}

	if(xml_FindValue(XMLString, len, "imex/exga", result) == 1)
	{
		param->extend_gamma = atoi(result);
		flag = 1;
	}

	if(xml_FindValue(XMLString, len, "imex/cnst", result) == 1)
	{
		param->contrast = atoi(result);
		flag = 1;
	}

	if(xml_FindValue(XMLString, len, "imex/coki", result) == 1)
	{
		param->colorkill = atoi(result);
		flag = 1;
	}

	if(xml_FindValue(XMLString, len, "imex/exno", result) == 1)
	{
		param->extend_noise = atoi(result);
		flag = 1;
	}

	if(xml_FindValue(XMLString, len, "imex/high", result) == 1)
	{
		param->HIGH = atoi(result);
		flag = 1;
	}


	return flag;
}
#endif



